A lot more work on WASM script execution
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
0
tests/common/data_getter.rs
Normal file → Executable file
0
tests/common/data_getter.rs
Normal file → Executable file
0
tests/common/library_loader.rs
Normal file → Executable file
0
tests/common/library_loader.rs
Normal file → Executable file
0
tests/common/mod.rs
Normal file → Executable file
0
tests/common/mod.rs
Normal file → Executable file
0
tests/common/test_case.rs
Normal file → Executable file
0
tests/common/test_case.rs
Normal file → Executable file
0
tests/common/test_step.rs
Normal file → Executable file
0
tests/common/test_step.rs
Normal file → Executable file
0
tests/data/Abilities.json
Normal file → Executable file
0
tests/data/Abilities.json
Normal file → Executable file
0
tests/data/GrowthRates.json
Normal file → Executable file
0
tests/data/GrowthRates.json
Normal file → Executable file
0
tests/data/Items.json
Normal file → Executable file
0
tests/data/Items.json
Normal file → Executable file
0
tests/data/Moves.json
Normal file → Executable file
0
tests/data/Moves.json
Normal file → Executable file
0
tests/data/Natures.csv
Normal file → Executable file
0
tests/data/Natures.csv
Normal file → Executable file
0
tests/data/Pokemon.json
Normal file → Executable file
0
tests/data/Pokemon.json
Normal file → Executable file
0
tests/data/Types.csv
Normal file → Executable file
0
tests/data/Types.csv
Normal file → Executable file
Binary file not shown.
51
tests/main.rs
Normal file → Executable file
51
tests/main.rs
Normal file → Executable file
@@ -9,8 +9,7 @@ use std::sync::Arc;
|
||||
|
||||
use conquer_once::OnceCell;
|
||||
|
||||
use pkmn_lib::dynamic_data::{DynamicLibrary, MoveChoice, PokemonBuilder, ScriptCategory, TurnChoice};
|
||||
use pkmn_lib::static_data::EffectParameter;
|
||||
use pkmn_lib::dynamic_data::DynamicLibrary;
|
||||
|
||||
use crate::common::{library_loader, TestCase};
|
||||
|
||||
@@ -51,51 +50,3 @@ fn integration_tests(input: &Path) {
|
||||
println!("\tRunning integration test {}", test_case.name);
|
||||
test_case.run_test(get_library());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(miri, ignore)]
|
||||
fn validate_script() {
|
||||
let lib = get_library();
|
||||
let script = lib
|
||||
.load_script(std::ptr::null(), ScriptCategory::Move, &"test".into())
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let parameters = [EffectParameter::String("foo".into())];
|
||||
script.on_initialize(&lib, ¶meters);
|
||||
script.on_initialize(&lib, ¶meters);
|
||||
script.on_initialize(&lib, ¶meters);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(miri, ignore)]
|
||||
fn validate_script_2() {
|
||||
let lib = get_library();
|
||||
let script = lib
|
||||
.load_script(std::ptr::null(), ScriptCategory::Move, &"test".into())
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let user = Arc::new(
|
||||
PokemonBuilder::new(lib, "charizard".into(), 100)
|
||||
.learn_move("fire_blast".into())
|
||||
.build(),
|
||||
);
|
||||
script.on_before_turn(&TurnChoice::Move(MoveChoice::new(
|
||||
user.clone(),
|
||||
user.learned_moves().read().get(0).unwrap().as_ref().unwrap().clone(),
|
||||
0,
|
||||
0,
|
||||
)));
|
||||
assert_eq!(user.current_health(), user.max_health() - 50);
|
||||
|
||||
let mut speed: u32 = 100;
|
||||
script.change_speed(
|
||||
&TurnChoice::Move(MoveChoice::new(
|
||||
user.clone(),
|
||||
user.learned_moves().read().get(0).unwrap().as_ref().unwrap().clone(),
|
||||
0,
|
||||
0,
|
||||
)),
|
||||
&mut speed,
|
||||
);
|
||||
assert_eq!(speed, 684);
|
||||
}
|
||||
|
||||
0
tests/test_cases/basic_single_turn.yaml
Normal file → Executable file
0
tests/test_cases/basic_single_turn.yaml
Normal file → Executable file
Reference in New Issue
Block a user