From 286763000e4e5919c07f2840c64ecc7932530175 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Mon, 25 Jun 2018 20:26:05 +0200 Subject: 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. --- tests/live-comparison.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'tests/live-comparison.rs') 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()) + } } } -- cgit v1.2.3