From 206d2074529e3fa6bc7ac2627a881c8495112b18 Mon Sep 17 00:00:00 2001 From: ntr Date: Thu, 12 Dec 2019 16:44:26 +1000 Subject: [PATCH] more game tests --- core/src/game.rs | 122 +++++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/core/src/game.rs b/core/src/game.rs index 3d638240..bcecdaad 100644 --- a/core/src/game.rs +++ b/core/src/game.rs @@ -1109,94 +1109,94 @@ mod tests { return game.resolve_phase_start(); } - // #[test] - // fn phase_test() { - // let mut game = create_test_game(); + #[test] + fn phase_test() { + let mut game = create_test_game(); - // let x_player = game.players[0].clone(); - // let y_player = game.players[1].clone(); + let x_player = game.players[0].clone(); + let y_player = game.players[1].clone(); - // let x_construct = x_player.constructs[0].clone(); - // let y_construct = y_player.constructs[0].clone(); + let x_construct = x_player.constructs[0].clone(); + let y_construct = y_player.constructs[0].clone(); - // game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Attack).unwrap(); - // game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap(); + game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Attack).unwrap(); + game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap(); - // game.player_ready(x_player.id).unwrap(); - // game.player_ready(y_player.id).unwrap(); + game.player_ready(x_player.id).unwrap(); + game.player_ready(y_player.id).unwrap(); - // assert!(game.skill_phase_finished()); + assert!(game.skill_phase_finished()); - // game = game.resolve_phase_start(); + game = game.resolve_phase_start(); - // assert!([Phase::Skill, Phase::Finished].contains(&game.phase)); + assert!([Phase::Skill, Phase::Finished].contains(&game.phase)); - // return; - // } + return; + } - // #[test] - // fn stun_test() { - // let mut game = create_test_game(); + #[test] + fn stun_test() { + let mut game = create_test_game(); - // let x_player = game.players[0].clone(); - // let y_player = game.players[1].clone(); + let x_player = game.players[0].clone(); + let y_player = game.players[1].clone(); - // let x_construct = x_player.constructs[0].clone(); - // let y_construct = y_player.constructs[0].clone(); + let x_construct = x_player.constructs[0].clone(); + let y_construct = y_player.constructs[0].clone(); - // while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Stun).is_some() { - // game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns(); - // } + while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Stun).is_some() { + game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns(); + } - // game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Stun).unwrap(); - // game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap(); + game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Stun).unwrap(); + game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap(); - // game.player_ready(x_player.id).unwrap(); - // game.player_ready(y_player.id).unwrap(); + game.player_ready(x_player.id).unwrap(); + game.player_ready(y_player.id).unwrap(); - // assert!(game.skill_phase_finished()); - // game = game.resolve_phase_start(); + assert!(game.skill_phase_finished()); + game = game.resolve_phase_start(); - // // should auto progress back to skill phase - // assert!(game.phase == Phase::Skill); + // should auto progress back to skill phase + assert!(game.phase == Phase::Skill); - // // assert!(game.player_by_id(y_player.id).constructs[0].is_stunned()); - // // assert!(game.player_by_id(y_player.id).skills_required() == 0); - // } + // assert!(game.player_by_id(y_player.id).constructs[0].is_stunned()); + // assert!(game.player_by_id(y_player.id).skills_required() == 0); + } - // #[test] - // fn ko_resolution_test() { - // let mut game = create_test_game(); + #[test] + fn ko_resolution_test() { + let mut game = create_test_game(); - // let x_player = game.players[0].clone(); - // let y_player = game.players[1].clone(); + let x_player = game.players[0].clone(); + let y_player = game.players[1].clone(); - // let x_construct = x_player.constructs[0].clone(); - // let y_construct = y_player.constructs[0].clone(); + let x_construct = x_player.constructs[0].clone(); + let y_construct = y_player.constructs[0].clone(); - // game.player_by_id(y_player.id).unwrap().construct_by_id(y_construct.id).unwrap().red_power.force(1000000000); - // game.player_by_id(y_player.id).unwrap().construct_by_id(y_construct.id).unwrap().speed.force(1000000000); + game.player_by_id(y_player.id).unwrap().construct_by_id(y_construct.id).unwrap().red_power.force(1000000000); + game.player_by_id(y_player.id).unwrap().construct_by_id(y_construct.id).unwrap().speed.force(1000000000); - // while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Stun).is_some() { - // game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns(); - // } + while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Stun).is_some() { + game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns(); + } - // // just in case - // // remove all mitigation - // game.player_by_id(x_player.id).unwrap().construct_by_id(x_construct.id).unwrap().red_life.force(0); + // just in case + // remove all mitigation + game.player_by_id(x_player.id).unwrap().construct_by_id(x_construct.id).unwrap().red_life.force(0); - // game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Stun).unwrap(); - // game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap(); + game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Stun).unwrap(); + game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap(); - // game.player_ready(x_player.id).unwrap(); - // game.player_ready(y_player.id).unwrap(); + game.player_ready(x_player.id).unwrap(); + game.player_ready(y_player.id).unwrap(); - // assert!(game.skill_phase_finished()); - // game = game.resolve_phase_start(); + assert!(game.skill_phase_finished()); + game = game.resolve_phase_start(); - // assert!(!game.player_by_id(y_player.id).unwrap().constructs[0].is_stunned()); - // assert!(game.phase == Phase::Finished); - // } + assert!(!game.player_by_id(y_player.id).unwrap().constructs[0].is_stunned()); + assert!(game.phase == Phase::Finished); + } #[test] fn cooldown_test() {