summaryrefslogtreecommitdiff
path: root/tests/live-comparison.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-06-02 23:54:35 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-06-02 23:54:35 +0200
commit6f328fbe981b2bfb231b3e29db4a48ca98a9968a (patch)
treea01877a72fee11fc0f12ef582d198fdeb8b1ea2e /tests/live-comparison.rs
parentb39b6c077b3df677eb877d723e279e29b2973128 (diff)
Added engine run with failing test example
Diffstat (limited to 'tests/live-comparison.rs')
-rw-r--r--tests/live-comparison.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/live-comparison.rs b/tests/live-comparison.rs
index e8f2b3a..72358a7 100644
--- a/tests/live-comparison.rs
+++ b/tests/live-comparison.rs
@@ -10,10 +10,18 @@ use std::io::prelude::*;
#[test]
fn it_successfully_simulates_replay() {
- let replay_folder = "tests/after_112";
+ test_from_replay("tests/after_112", 54);
+}
+
+#[test]
+fn it_successfully_simulates_replay_two() {
+ test_from_replay("tests/after_112_2", 76);
+}
+
+fn test_from_replay(replay_folder: &str, length: usize) {
let (settings, mut state) = json::read_state_from_file(&format!("{}/Round 000/state.json", replay_folder)).unwrap();
- for i in 0..54 {
+ 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), &settings);
let (_, mut expected_state) = json::read_state_from_file(&format!("{}/Round {:03}/state.json", replay_folder, i+1)).unwrap();