summaryrefslogtreecommitdiff
path: root/tests/live_comparison.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-08-12 11:07:41 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-08-12 11:07:41 +0200
commit6935a0c82606b95391dfd76c01e393ca99d6bf77 (patch)
tree91207be0c5e2e4e0a33f3492b719bd3abc2e25dc /tests/live_comparison.rs
parenta760bc7543b186714b11648e8be515dcdfc49b95 (diff)
Test for iron curtain availability and normal towers
Diffstat (limited to 'tests/live_comparison.rs')
-rw-r--r--tests/live_comparison.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/live_comparison.rs b/tests/live_comparison.rs
index 3297fa8..ca2ba1b 100644
--- a/tests/live_comparison.rs
+++ b/tests/live_comparison.rs
@@ -6,24 +6,22 @@ use zombot::engine::geometry::Point;
use std::fs::File;
use std::io::prelude::*;
+use std::path::Path;
#[test]
fn it_successfully_simulates_replay() {
- test_from_replay("tests/after_200", 64);
+ test_from_replay(&Path::new("tests/v300_normal_towers"));
}
-#[test]
-fn it_successfully_simulates_replay_with_teslas() {
- test_from_replay("tests/after_203_teslas", 60);
-}
-
-fn test_from_replay(replay_folder: &str, length: usize) {
- let mut state = json::read_bitwise_state_from_file(&format!("{}/Round 000/state.json", replay_folder)).unwrap();
+fn test_from_replay(replay_folder: &Path) {
+ let length = replay_folder.read_dir().unwrap().count()-1;
+
+ let mut state = json::read_bitwise_state_from_file(&format!("{}/Round 000/state.json", replay_folder.display())).unwrap();
for i in 0..length {
- let player = read_player_command(&format!("{}/Round {:03}/PlayerCommand.txt", replay_folder, i));
- let opponent = read_opponent_command(&format!("{}/Round {:03}/OpponentCommand.txt", replay_folder, i));
- let mut expected_state = json::read_bitwise_state_from_file(&format!("{}/Round {:03}/state.json", replay_folder, i+1)).unwrap();
+ let player = read_player_command(&format!("{}/Round {:03}/PlayerCommand.txt", replay_folder.display(), i));
+ let opponent = read_opponent_command(&format!("{}/Round {:03}/OpponentCommand.txt", replay_folder.display(), i));
+ let mut expected_state = json::read_bitwise_state_from_file(&format!("{}/Round {:03}/state.json", replay_folder.display(), i+1)).unwrap();
state.simulate(player, opponent);
state.sort();