Major work on WASM results
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use serde::Deserialize;
|
||||
use std::sync::Arc;
|
||||
|
||||
use pkmn_lib::dynamic_data::Battle;
|
||||
|
||||
@@ -9,7 +10,7 @@ pub enum TestDataGetter {
|
||||
}
|
||||
|
||||
impl TestDataGetter {
|
||||
pub fn get(&self, battle: &Battle) -> String {
|
||||
pub fn get(&self, battle: &Arc<Battle>) -> String {
|
||||
match self {
|
||||
TestDataGetter::PokemonHealth { index } => battle
|
||||
.get_pokemon(index[0], index[1])
|
||||
|
||||
@@ -58,7 +58,7 @@ impl TestCase {
|
||||
for party in parties {
|
||||
battle_parties.push(BattleParty::new(party.0.clone(), party.1).unwrap());
|
||||
}
|
||||
let mut battle = Battle::new(
|
||||
let battle = Battle::new(
|
||||
library,
|
||||
battle_parties,
|
||||
self.battle_setup.can_flee,
|
||||
@@ -67,7 +67,7 @@ impl TestCase {
|
||||
Some(self.battle_setup.seed),
|
||||
);
|
||||
for action in &self.actions {
|
||||
action.execute(&mut battle);
|
||||
action.execute(&battle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use serde::Deserialize;
|
||||
use std::sync::Arc;
|
||||
|
||||
use pkmn_lib::dynamic_data::Battle;
|
||||
use pkmn_lib::dynamic_data::{MoveChoice, PassChoice, TurnChoice};
|
||||
@@ -31,11 +32,11 @@ pub enum TestStep {
|
||||
}
|
||||
|
||||
impl TestStep {
|
||||
pub fn execute(&self, battle: &mut Battle) {
|
||||
pub fn execute(&self, battle: &Arc<Battle>) {
|
||||
match self {
|
||||
TestStep::SetPokemon { place, from_party } => {
|
||||
let p = battle.parties()[from_party[0] as usize].get_pokemon(from_party[1] as usize);
|
||||
battle.sides_mut()[place[0] as usize].set_pokemon(place[1], p).unwrap();
|
||||
battle.sides()[place[0] as usize].set_pokemon(place[1], p).unwrap();
|
||||
}
|
||||
TestStep::SetMoveChoice {
|
||||
for_pokemon,
|
||||
@@ -72,7 +73,7 @@ impl TestStep {
|
||||
assert!(battle.try_set_choice(TurnChoice::Pass(PassChoice::new(p))).unwrap());
|
||||
}
|
||||
TestStep::Assert { value, expected } => {
|
||||
let v = value.get(battle);
|
||||
let v = value.get(&battle);
|
||||
assert_eq!(&v, expected)
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user