summaryrefslogtreecommitdiff
path: root/tests/monte_carlo_test.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2018-09-06 21:51:50 +0200
committerJustin Worthe <justin@worthe-it.co.za>2018-09-06 21:51:50 +0200
commit90a7c7d34def7e5f92f2cd521fdc014e0cbd9906 (patch)
tree65b45bbf4bc7204b6189d6fb39180a39527b14eb /tests/monte_carlo_test.rs
parent4ad0035f4f11b41e400a1f567fdcd3541fa3f21e (diff)
Added benchmarking for number of explored nodes
Diffstat (limited to 'tests/monte_carlo_test.rs')
-rw-r--r--tests/monte_carlo_test.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/monte_carlo_test.rs b/tests/monte_carlo_test.rs
index 1fb4238..470c92d 100644
--- a/tests/monte_carlo_test.rs
+++ b/tests/monte_carlo_test.rs
@@ -19,3 +19,16 @@ fn it_does_a_normal_turn_successfully() {
assert!(start_time.to(PreciseTime::now()) < max_time + Duration::milliseconds(50))
}
+
+#[test]
+fn it_does_a_normal_tree_serach_turn_successfully() {
+ let start_time = PreciseTime::now();
+ let state = match input::json::read_bitwise_state_from_file(STATE_PATH) {
+ Ok(ok) => ok,
+ Err(error) => panic!("Error while parsing JSON file: {}", error)
+ };
+ let max_time = Duration::milliseconds(20000);
+ strategy::monte_carlo_tree::choose_move(&state, start_time, max_time);
+
+ assert!(start_time.to(PreciseTime::now()) < max_time + Duration::milliseconds(50))
+}