diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2019-08-07 14:37:36 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2019-08-07 14:37:36 +0200 |
commit | d4539771bca817add851ef484de4773cbbe43f79 (patch) | |
tree | 371556db78894f666425d8d28a67b23f89aed196 /tests/official-runner-matching.rs | |
parent | 096091af6a3a4d16da133037321c81a51e1bb4b2 (diff) |
Assertions to test that my lava logic is right
Diffstat (limited to 'tests/official-runner-matching.rs')
-rw-r--r-- | tests/official-runner-matching.rs | 13 |
1 files changed, 10 insertions, 3 deletions
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::<String>(); let x = char_iter .by_ref() - .take_while(|c| *c != ',') + .take_while(|c| *c != ' ') .collect::<String>() .trim() .parse::<i8>() .unwrap(); let y = char_iter .by_ref() - .take_while(|c| *c != ')') + .take_while(|c| *c != ' ') .collect::<String>() .trim() .parse::<i8>() |