From 7b4f42242d277adeaec7a40eaac7d178141d4621 Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Tue, 29 Jan 2019 19:12:22 +0000 Subject: Reorganise submodules (and submodulise solvitaire) The submodules should now point to repos I've made in order to produce static libraries from them. Also, solvitaire now points to a similar personal repo. --- solvitaire | 1 + .../src/test/integration_tests/canfield_test.cpp | 139 --------------------- 2 files changed, 1 insertion(+), 139 deletions(-) create mode 160000 solvitaire delete mode 100644 solvitaire/src/test/integration_tests/canfield_test.cpp (limited to 'solvitaire/src/test/integration_tests/canfield_test.cpp') diff --git a/solvitaire b/solvitaire new file mode 160000 index 0000000..b835e10 --- /dev/null +++ b/solvitaire @@ -0,0 +1 @@ +Subproject commit b835e10bfb21a73b4f89e09ddeb400f415384835 diff --git a/solvitaire/src/test/integration_tests/canfield_test.cpp b/solvitaire/src/test/integration_tests/canfield_test.cpp deleted file mode 100644 index 0cb14b2..0000000 --- a/solvitaire/src/test/integration_tests/canfield_test.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// -// Created by thecharlesblake on 10/4/17. -// - -#include - -#include "../test_helper.h" -#include "../../main/input-output/input/json-parsing/rules_parser.h" -#include "../../main/game/search-state/game_state.h" - -using std::vector; - -typedef test_helper th; -typedef game_state::streamliner_options so; -typedef std::initializer_list> string_il; - -const static std::string path = "resources/canfield/"; -const static std::string type = "simple-canfield"; - -TEST(Canfield, SimpleSolvable) { - EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); -} - -TEST(Canfield, ComplexSolvable) { - EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); -} - -TEST(Canfield, SimpleUnsolvable) { - EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); -} - -TEST(Canfield, ComplexUnsolvable) { - EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); -} - -TEST(Canfield, FoundationSingleCard) { - sol_rules sr = rules_parser::from_preset("canfield"); - game_state gs(sr, 0, so::NONE); - - ASSERT_EQ(1, test_helper::cards_in_founds(gs)); -} - -TEST(Canfield, FoundationWraps) { - sol_rules sr = rules_parser::from_preset("simple-canfield"); - - game_state gs(sr, string_il{ - {"3C"},{},{},{}, // Foundations - {},{}, // Stock-waste - {}, // Reserve - {"AC"},{},{} // Tableau piles - }); - - vector actual_moves = gs.get_legal_moves(); - vector exp_moves = { - move(move::mtype::regular, 7, 0, 1) - }; - - ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves; -} - -TEST(Canfield, MoveWholePile) { - sol_rules sr = rules_parser::from_preset("simple-canfield"); - - game_state gs(sr, string_il{ - {"AC"},{},{},{}, // Foundations - {},{}, // Stock-waste - {}, // Reserve - {"2C","AH"},{"3H"},{"3C","2D"} // Tableau piles - }); - - vector actual_moves = gs.get_legal_moves(); - vector exp_moves = { - move(move::mtype::built_group, 7, 8, 2), - move(move::mtype::regular, 7, 1, 1), - }; - - ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves; -} - -TEST(Canfield, MoveWholePileNotSpace) { - sol_rules sr = rules_parser::from_preset("simple-canfield"); - - game_state gs(sr, string_il{ - {"3C"},{},{},{}, // Foundations - {},{}, // Stock-waste - {}, // Reserve - {"2H","3S","AH"},{},{"2D"} // Tableau piles - }); - - vector actual_moves = gs.get_legal_moves(); - vector exp_moves = {}; - - ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves; -} - -TEST(Canfield, AutoReserve) { - sol_rules sr = rules_parser::from_preset("simple-canfield"); - - game_state gs(sr, string_il{ - {"2C"},{},{},{}, // Foundations - {"3D","2D"},{}, // Stock-waste - {"3H"}, // Reserve - {"2H","3S","AH"},{},{"AC"} // Tableau piles - }); - - vector actual_moves = gs.get_legal_moves(); - vector exp_moves = {}; - - ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves; - - boost::optional actual_dom_move = gs.get_dominance_move(); - boost::optional exp_dom_move = move(move::mtype::dominance, 6, 8, 1); - - ASSERT_EQ(exp_dom_move, actual_dom_move) << *actual_dom_move; -} - -TEST(Canfield, AutoReserveThenWaste) { - sol_rules sr = rules_parser::from_preset("simple-canfield"); - - game_state gs(sr, string_il{ - {"3C"},{},{},{}, // Foundations - {"2D"},{"2S"}, // Stock-waste - {}, // Reserve - {"2H","3S","AH"},{},{"AD"} // Tableau piles - }); - - vector actual_moves = gs.get_legal_moves(); - vector exp_moves = { - move(move::mtype::stock_k_plus, 4, 8, 0), - move(move::mtype::stock_k_plus, 4, 8, 1) - }; - - ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves; - - boost::optional actual_dom_move = gs.get_dominance_move(); - boost::optional exp_dom_move = boost::none; - - ASSERT_EQ(exp_dom_move, actual_dom_move) << *actual_dom_move; -} -- cgit v1.2.1