From d4539771bca817add851ef484de4773cbbe43f79 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Wed, 7 Aug 2019 14:37:36 +0200 Subject: Assertions to test that my lava logic is right --- tests/official-runner-matching.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tests/official-runner-matching.rs') diff --git a/tests/official-runner-matching.rs b/tests/official-runner-matching.rs index 5389558..fb9fb8c 100644 --- a/tests/official-runner-matching.rs +++ b/tests/official-runner-matching.rs @@ -179,6 +179,13 @@ fn read_move(csv_line: &[String], expected_worm_id: i32) -> Command { action: Action::Bomb(Point2d::new(x, y)), } } + "snowball" => { + let (x, y) = read_xy_pair(&csv_line[2]); + Command { + worm: select, + action: Action::Snowball(Point2d::new(x, y)), + } + } "nothing" | "invalid" => Command { worm: select, action: Action::DoNothing, @@ -212,18 +219,18 @@ fn read_xy_pair(input: &str) -> (i8, i8) { let mut char_iter = input.chars(); let _ = char_iter .by_ref() - .take_while(|c| *c != '(') + .take_while(|c| *c != ' ') .collect::(); let x = char_iter .by_ref() - .take_while(|c| *c != ',') + .take_while(|c| *c != ' ') .collect::() .trim() .parse::() .unwrap(); let y = char_iter .by_ref() - .take_while(|c| *c != ')') + .take_while(|c| *c != ' ') .collect::() .trim() .parse::() -- cgit v1.2.3