diff options
| author | thecharlesblake | 2018-02-14 16:58:08 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-02-14 16:59:07 +0000 |
| commit | 2a0cfd3af6d5dd5e4c7a49e713f13d65f1ad977a (patch) | |
| tree | 6a7efe88872c268cbf231ffd24e87eaceba650cb /src/test/test_helper.cpp | |
| parent | Update benchmark resources path & add no auto flag (diff) | |
| download | metasol-2a0cfd3af6d5dd5e4c7a49e713f13d65f1ad977a.tar.gz metasol-2a0cfd3af6d5dd5e4c7a49e713f13d65f1ad977a.zip | |
Add foundations dominance testing
Diffstat (limited to 'src/test/test_helper.cpp')
| -rw-r--r-- | src/test/test_helper.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/test_helper.cpp b/src/test/test_helper.cpp index 9ee1233..246de38 100644 --- a/src/test/test_helper.cpp +++ b/src/test/test_helper.cpp @@ -78,3 +78,35 @@ void test_helper::run_card_cache_test(sol_rules::build_policy bp, } } } + +void test_helper::run_foundations_dominance_test(sol_rules::build_policy policy, + std::vector<card> cards) { + sol_rules rules = rules_parser::from_preset("simple-free-cell"); + rules.build_pol = policy; + rules.foundations_removable = false; + rules.cells = 0; + + game_state gs = game_state(rules, std::initializer_list<pile>{ + {}, + {}, + {}, + {}, + {"4C","3C","2C","AC"}, + {"4H","3H","2H","AH"}, + {"4S","3S","2S","AS"}, + {"4D","3D","2D","AD"} + }); + + solver sol = solver(game_state(gs)); + sol.run(); + + solver::node const *n = &sol.get_search_tree(); + for (card c : cards) { + n = &n->children.back(); + ASSERT_TRUE(n->move.is_dominance()); + ASSERT_TRUE(gs.get_data()[n->move.from].top_card() == c); + ASSERT_TRUE(n->move.to >= 0 && n->move.to <= 4); + gs.make_move(n->move); + } + ASSERT_TRUE(n->children.empty()); +} |
