Support for new error handling.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -65,7 +65,7 @@ pub fn load_library() -> LoadResult {
|
||||
let species_load_time = t2 - t1;
|
||||
|
||||
let data = StaticDataImpl::new(
|
||||
Box::new(LibrarySettingsImpl::new(100, 100)),
|
||||
Box::new(LibrarySettingsImpl::new(100, 100).unwrap()),
|
||||
species,
|
||||
moves,
|
||||
items,
|
||||
|
||||
@@ -79,6 +79,6 @@ impl TestPokemon {
|
||||
builder = builder.learn_move(StringKey::new(move_name));
|
||||
}
|
||||
|
||||
builder.build()
|
||||
builder.build().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,18 +45,56 @@ fn validate_library_load() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn load_non_existing_wasm_script() {
|
||||
let start_time = chrono::Utc::now();
|
||||
let result = library_loader::load_library();
|
||||
let end_time = chrono::Utc::now();
|
||||
println!(
|
||||
"Built library in {} ms\
|
||||
\n\t- Types load time: {} ms\
|
||||
\n\t- Natures load time: {} ms\
|
||||
\n\t- Items load time: {} ms\
|
||||
\n\t- Growth Rate load time: {} ms\
|
||||
\n\t- Abilities load time: {} ms\
|
||||
\n\t- Moves load time: {} ms\
|
||||
\n\t- Species load time: {} ms\
|
||||
\n\t- WASM load time: {} ms\
|
||||
",
|
||||
(end_time - start_time).num_milliseconds(),
|
||||
result.types_load_time.num_milliseconds(),
|
||||
result.natures_load_time.num_milliseconds(),
|
||||
result.items_load_time.num_milliseconds(),
|
||||
result.growth_rate_load_time.num_milliseconds(),
|
||||
result.abilities_load_time.num_milliseconds(),
|
||||
result.moves_load_time.num_milliseconds(),
|
||||
result.species_load_time.num_milliseconds(),
|
||||
result.wasm_load_time.num_milliseconds(),
|
||||
);
|
||||
let script = result
|
||||
.library
|
||||
.load_script(ScriptOwnerData::None, ScriptCategory::Move, &"_____non_existing".into())
|
||||
.unwrap();
|
||||
|
||||
assert!(script.is_none());
|
||||
}
|
||||
|
||||
/// Assurance has the interesting properties that it creates a special data script internally, and
|
||||
/// deletes that data script through the get_owner functionality.
|
||||
#[test]
|
||||
#[cfg_attr(miri, ignore)]
|
||||
fn validate_assurance() {
|
||||
let lib = get_library();
|
||||
let p1 = Arc::new(
|
||||
PokemonBuilder::new(lib.clone(), "charizard".into(), 100)
|
||||
.learn_move("assurance".into())
|
||||
.build(),
|
||||
.build()
|
||||
.unwrap(),
|
||||
);
|
||||
let p2 = Arc::new(
|
||||
PokemonBuilder::new(lib.clone(), "venusaur".into(), 100)
|
||||
.build()
|
||||
.unwrap(),
|
||||
);
|
||||
let p2 = Arc::new(PokemonBuilder::new(lib.clone(), "venusaur".into(), 100).build());
|
||||
|
||||
let party1 = BattleParty::new(
|
||||
Arc::new(PokemonParty::new_from_vec(vec![Some(p1.clone())])),
|
||||
|
||||
Reference in New Issue
Block a user