summaryrefslogtreecommitdiff
path: root/tests/monte_carlo_test.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-07-01 12:11:51 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-07-01 12:11:51 +0200
commit1ac0449bd0313ad01da0d253f7b45b45287314b7 (patch)
tree499c9693204874dd0f285af09018adfd7c003939 /tests/monte_carlo_test.rs
parent96dfb9375125a2473fc639510653ae5ce2600343 (diff)
Renamed tests to follow underscore convention
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);
+}