diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-06-25 20:26:05 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-06-25 20:26:05 +0200 |
commit | 286763000e4e5919c07f2840c64ecc7932530175 (patch) | |
tree | 5d89610326de388ec1937f07a9562df85699fe9e /tests/live-comparison.rs | |
parent | 7bf7d8d977733cb02258b4a79faf2417c52e9323 (diff) |
Updated test cases and made engine work correctly according to tests
I don't think a tesla appeared in this match. I need to contrive a bot
to build one.
Diffstat (limited to 'tests/live-comparison.rs')
-rw-r--r-- | tests/live-comparison.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/live-comparison.rs b/tests/live-comparison.rs index 621c247..e063959 100644 --- a/tests/live-comparison.rs +++ b/tests/live-comparison.rs @@ -10,7 +10,7 @@ use std::io::prelude::*; #[test] fn it_successfully_simulates_replay() { - test_from_replay("tests/after_113", 32); + test_from_replay("tests/after_200", 62); } fn test_from_replay(replay_folder: &str, length: usize) { @@ -37,12 +37,14 @@ fn read_player_command(filename: &str) -> Command { } else { let mut components = content.split(','); - Command::Build( - Point::new(components.next().unwrap().trim().parse().unwrap(), - components.next().unwrap().trim().parse().unwrap() - ), - BuildingType::from_u8(components.next().unwrap().trim().parse().unwrap()).unwrap() - ) + let point = Point::new(components.next().unwrap().trim().parse().unwrap(), + components.next().unwrap().trim().parse().unwrap()); + let action_type = components.next().unwrap().trim().parse().unwrap(); + if action_type == 3 { + Command::Deconstruct(point) + } else { + Command::Build(point, BuildingType::from_u8(action_type).unwrap()) + } } } |