summaryrefslogtreecommitdiff
path: root/tests/monte-carlo-test.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-06-25 20:26:05 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-06-25 20:26:05 +0200
commit286763000e4e5919c07f2840c64ecc7932530175 (patch)
tree5d89610326de388ec1937f07a9562df85699fe9e /tests/monte-carlo-test.rs
parent7bf7d8d977733cb02258b4a79faf2417c52e9323 (diff)
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.
Diffstat (limited to 'tests/monte-carlo-test.rs')
-rw-r--r--tests/monte-carlo-test.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/monte-carlo-test.rs b/tests/monte-carlo-test.rs
new file mode 100644
index 0000000..479b36d
--- /dev/null
+++ b/tests/monte-carlo-test.rs
@@ -0,0 +1,19 @@
+extern crate zombot;
+extern crate time;
+use time::{PreciseTime, Duration};
+
+use zombot::*;
+
+const STATE_PATH: &str = "tests/state0.json";
+
+// there are assertions in the game engine, run when it's in debug mode
+#[test]
+fn it_does_a_normal_turn_successfully() {
+ let start_time = PreciseTime::now();
+ let (settings, state) = match input::json::read_state_from_file(STATE_PATH) {
+ Ok(ok) => ok,
+ Err(error) => panic!("Error while parsing JSON file: {}", error)
+ };
+ let max_time = Duration::milliseconds(1950);
+ strategy::monte_carlo::choose_move(&settings, &state, &start_time, max_time);
+}