aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Harley2019-01-27 15:37:06 +0000
committerTom Harley2019-01-27 15:37:06 +0000
commita996283af7c21baaff0e114d58c34db820902c6f (patch)
tree2fe5b6f7a800d4a7b8a65ee345f8c98aa138e36b /src/test
parentSplit code into 3 files (diff)
downloadmetasol-a996283af7c21baaff0e114d58c34db820902c6f.tar.gz
metasol-a996283af7c21baaff0e114d58c34db820902c6f.zip

Reorganise repo

All solvitaire content has been shoved into a subdirectory to tidy up the root of the project. This also means solvitaire is treated similarly to other dependencies of the project, and allows other dependencies to be added easily.

There’s also a lot of other work done here, such as usign a thread pool library to manage the running of the voters.

Diffstat (limited to 'src/test')
-rw-r--r--src/test/integration_tests/accordion_test.cpp28
-rw-r--r--src/test/integration_tests/alpha_star_test.cpp28
-rw-r--r--src/test/integration_tests/bakers_dozen_test.cpp28
-rw-r--r--src/test/integration_tests/black_hole_test.cpp28
-rw-r--r--src/test/integration_tests/canfield_test.cpp139
-rw-r--r--src/test/integration_tests/flower_garden_test.cpp28
-rw-r--r--src/test/integration_tests/fortunes_favor_test.cpp28
-rw-r--r--src/test/integration_tests/free_cell_test.cpp28
-rw-r--r--src/test/integration_tests/gaps_test.cpp28
-rw-r--r--src/test/integration_tests/klondike_test.cpp28
-rw-r--r--src/test/integration_tests/somerset_test.cpp28
-rw-r--r--src/test/integration_tests/spanish_patience_test.cpp28
-rw-r--r--src/test/integration_tests/spider_test.cpp30
-rw-r--r--src/test/resources/accordion/ComplexSolvable.json3
-rw-r--r--src/test/resources/accordion/ComplexUnsolvable.json3
-rw-r--r--src/test/resources/accordion/SimpleSolvable.json3
-rw-r--r--src/test/resources/accordion/SimpleUnsolvable.json3
-rw-r--r--src/test/resources/alpha_star/ComplexSolvable.json7
-rw-r--r--src/test/resources/alpha_star/ComplexUnsolvable.json7
-rw-r--r--src/test/resources/alpha_star/SimpleSolvable.json7
-rw-r--r--src/test/resources/alpha_star/SimpleUnsolvable.json7
-rw-r--r--src/test/resources/bakers_dozen/ComplexSolvable.json7
-rw-r--r--src/test/resources/bakers_dozen/ComplexUnsolvable.json7
-rw-r--r--src/test/resources/bakers_dozen/SimpleSolvable.json7
-rw-r--r--src/test/resources/bakers_dozen/SimpleUnsolvable.json7
-rw-r--r--src/test/resources/black_hole/ComplexSolvable.json9
-rw-r--r--src/test/resources/black_hole/ComplexUnsolvable.json9
-rw-r--r--src/test/resources/black_hole/SimpleSolvable.json9
-rw-r--r--src/test/resources/black_hole/SimpleUnsolvable.json9
-rw-r--r--src/test/resources/canfield/ComplexSolvable.json10
-rw-r--r--src/test/resources/canfield/ComplexUnsolvable.json10
-rw-r--r--src/test/resources/canfield/SimpleSolvable.json10
-rw-r--r--src/test/resources/canfield/SimpleUnsolvable.json10
-rw-r--r--src/test/resources/flower_garden/ComplexSolvable.json8
-rw-r--r--src/test/resources/flower_garden/ComplexUnsolvable.json8
-rw-r--r--src/test/resources/flower_garden/SimpleSolvable.json8
-rw-r--r--src/test/resources/flower_garden/SimpleUnsolvable.json8
-rw-r--r--src/test/resources/fortunes_favor/ComplexSolvable.json8
-rw-r--r--src/test/resources/fortunes_favor/ComplexUnsolvable.json8
-rw-r--r--src/test/resources/fortunes_favor/SimpleSolvable.json8
-rw-r--r--src/test/resources/fortunes_favor/SimpleUnsolvable.json8
-rw-r--r--src/test/resources/free_cell/ComplexSolvable.json8
-rw-r--r--src/test/resources/free_cell/ComplexUnsolvable.json8
-rw-r--r--src/test/resources/free_cell/SimpleSolvable.json8
-rw-r--r--src/test/resources/free_cell/SimpleUnsolvable.json8
-rw-r--r--src/test/resources/gaps/ComplexSolvable.json8
-rw-r--r--src/test/resources/gaps/ComplexUnsolvable.json8
-rw-r--r--src/test/resources/gaps/SimpleSolvable.json8
-rw-r--r--src/test/resources/gaps/SimpleUnsolvable.json8
-rw-r--r--src/test/resources/klondike/ComplexSolvable.json9
-rw-r--r--src/test/resources/klondike/ComplexUnsolvable.json9
-rw-r--r--src/test/resources/klondike/SimpleSolvable.json9
-rw-r--r--src/test/resources/klondike/SimpleUnsolvable.json9
-rw-r--r--src/test/resources/somerset/ComplexSolvable.json8
-rw-r--r--src/test/resources/somerset/ComplexUnsolvable.json8
-rw-r--r--src/test/resources/somerset/SimpleSolvable.json8
-rw-r--r--src/test/resources/somerset/SimpleUnsolvable.json8
-rw-r--r--src/test/resources/spanish_patience/ComplexSolvable.json7
-rw-r--r--src/test/resources/spanish_patience/ComplexUnsolvable.json7
-rw-r--r--src/test/resources/spanish_patience/SimpleSolvable.json7
-rw-r--r--src/test/resources/spanish_patience/SimpleUnsolvable.json7
-rw-r--r--src/test/resources/spider/ComplexSolvable.json13
-rw-r--r--src/test/resources/spider/ComplexUnsolvable.json13
-rw-r--r--src/test/resources/spider/SimpleSolvable.json14
-rw-r--r--src/test/resources/spider/SimpleUnsolvable.json13
-rw-r--r--src/test/test_helper.cpp148
-rw-r--r--src/test/test_helper.h41
-rw-r--r--src/test/unit_tests/built_group_move_gen_test.cpp313
-rw-r--r--src/test/unit_tests/card_test.cpp92
-rw-r--r--src/test/unit_tests/deal_parser_test.cpp143
-rw-r--r--src/test/unit_tests/face_up_cards_test.cpp317
-rw-r--r--src/test/unit_tests/foundations_dominance_test.cpp29
-rw-r--r--src/test/unit_tests/global_cache_test.cpp78
-rw-r--r--src/test/unit_tests/k_plus_stock_test.cpp426
-rw-r--r--src/test/unit_tests/legal_move_gen_test.cpp326
-rw-r--r--src/test/unit_tests/pile_test.cpp87
76 files changed, 0 insertions, 2898 deletions
diff --git a/src/test/integration_tests/accordion_test.cpp b/src/test/integration_tests/accordion_test.cpp
deleted file mode 100644
index bd27dec..0000000
--- a/src/test/integration_tests/accordion_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/accordion/";
-const static std::string type = "simple-accordion";
-
-TEST(Accordion, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(Accordion, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(Accordion, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(Accordion, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/alpha_star_test.cpp b/src/test/integration_tests/alpha_star_test.cpp
deleted file mode 100644
index c3b23fe..0000000
--- a/src/test/integration_tests/alpha_star_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/alpha_star/";
-const static std::string type = "simple-alpha-star";
-
-TEST(AlphaStar, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(AlphaStar, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(AlphaStar, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(AlphaStar, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/bakers_dozen_test.cpp b/src/test/integration_tests/bakers_dozen_test.cpp
deleted file mode 100644
index f3d4763..0000000
--- a/src/test/integration_tests/bakers_dozen_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/bakers_dozen/";
-const static std::string type = "simple-bakers-dozen";
-
-TEST(BakersDozen, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(BakersDozen, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(BakersDozen, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(BakersDozen, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/black_hole_test.cpp b/src/test/integration_tests/black_hole_test.cpp
deleted file mode 100644
index a0f6707..0000000
--- a/src/test/integration_tests/black_hole_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/black_hole/";
-const static std::string type = "simple-black-hole";
-
-TEST(BlackHole, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(BlackHole, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(BlackHole, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(BlackHole, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/canfield_test.cpp b/src/test/integration_tests/canfield_test.cpp
deleted file mode 100644
index 0cb14b2..0000000
--- a/src/test/integration_tests/canfield_test.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#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<std::initializer_list<std::string>> 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<move> actual_moves = gs.get_legal_moves();
- vector<move> 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<move> actual_moves = gs.get_legal_moves();
- vector<move> 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<move> actual_moves = gs.get_legal_moves();
- vector<move> 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<move> actual_moves = gs.get_legal_moves();
- vector<move> exp_moves = {};
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-
- boost::optional<move> actual_dom_move = gs.get_dominance_move();
- boost::optional<move> 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<move> actual_moves = gs.get_legal_moves();
- vector<move> 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<move> actual_dom_move = gs.get_dominance_move();
- boost::optional<move> exp_dom_move = boost::none;
-
- ASSERT_EQ(exp_dom_move, actual_dom_move) << *actual_dom_move;
-}
diff --git a/src/test/integration_tests/flower_garden_test.cpp b/src/test/integration_tests/flower_garden_test.cpp
deleted file mode 100644
index 641ccc0..0000000
--- a/src/test/integration_tests/flower_garden_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/flower_garden/";
-const static std::string type = "simple-flower-garden";
-
-TEST(FlowerGarden, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(FlowerGarden, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(FlowerGarden, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(FlowerGarden, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/fortunes_favor_test.cpp b/src/test/integration_tests/fortunes_favor_test.cpp
deleted file mode 100644
index 5511f9e..0000000
--- a/src/test/integration_tests/fortunes_favor_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/fortunes_favor/";
-const static std::string type = "simple-fortunes-favor";
-
-TEST(FortunesFavor, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(FortunesFavor, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(FortunesFavor, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(FortunesFavor, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/free_cell_test.cpp b/src/test/integration_tests/free_cell_test.cpp
deleted file mode 100644
index 659d86b..0000000
--- a/src/test/integration_tests/free_cell_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/free_cell/";
-const static std::string type = "simple-free-cell";
-
-TEST(FreeCell, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(FreeCell, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(FreeCell, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(FreeCell, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/gaps_test.cpp b/src/test/integration_tests/gaps_test.cpp
deleted file mode 100644
index f7d0ebe..0000000
--- a/src/test/integration_tests/gaps_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/gaps/";
-const static std::string type = "simple-gaps";
-
-TEST(Gaps, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(Gaps, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(Gaps, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(Gaps, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/klondike_test.cpp b/src/test/integration_tests/klondike_test.cpp
deleted file mode 100644
index d449495..0000000
--- a/src/test/integration_tests/klondike_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/klondike/";
-const static std::string type = "simple-klondike";
-
-TEST(Klondike, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(Klondike, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(Klondike, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(Klondike, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/somerset_test.cpp b/src/test/integration_tests/somerset_test.cpp
deleted file mode 100644
index fce8e8c..0000000
--- a/src/test/integration_tests/somerset_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/somerset/";
-const static std::string type = "simple-somerset";
-
-TEST(Somerset, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(Somerset, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(Somerset, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(Somerset, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/spanish_patience_test.cpp b/src/test/integration_tests/spanish_patience_test.cpp
deleted file mode 100644
index da32fd5..0000000
--- a/src/test/integration_tests/spanish_patience_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/spanish_patience/";
-const static std::string type = "simple-spanish-patience";
-
-TEST(SpanishPatience, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(SpanishPatience, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(SpanishPatience, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-TEST(SpanishPatience, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
diff --git a/src/test/integration_tests/spider_test.cpp b/src/test/integration_tests/spider_test.cpp
deleted file mode 100644
index 50f16fe..0000000
--- a/src/test/integration_tests/spider_test.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// Created by thecharlesblake on 10/4/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-
-typedef test_helper th;
-
-const static std::string path = "resources/spider/";
-const static std::string type = "simple-spider";
-
-TEST(Spider, SimpleSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
-}
-
-TEST(Spider, ComplexSolvable) {
- EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
-}
-
-TEST(Spider, SimpleUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
-}
-
-/* Taking too long so removed, at least for now
-TEST(Spider, ComplexUnsolvable) {
- EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
-}
-*/
diff --git a/src/test/resources/accordion/ComplexSolvable.json b/src/test/resources/accordion/ComplexSolvable.json
deleted file mode 100644
index cdb2367..0000000
--- a/src/test/resources/accordion/ComplexSolvable.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "accordion": ["AC","3H","AH","2S","AD","3S","3C","AS","2C","3D"]
-}
diff --git a/src/test/resources/accordion/ComplexUnsolvable.json b/src/test/resources/accordion/ComplexUnsolvable.json
deleted file mode 100644
index 09c7d32..0000000
--- a/src/test/resources/accordion/ComplexUnsolvable.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "accordion": ["AD","AS","AH","2S","3C","3S","4C","3H","2C","4D"]
-} \ No newline at end of file
diff --git a/src/test/resources/accordion/SimpleSolvable.json b/src/test/resources/accordion/SimpleSolvable.json
deleted file mode 100644
index 00de391..0000000
--- a/src/test/resources/accordion/SimpleSolvable.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "accordion": ["AC","AS","AH","2C","2S","2H","3C","3S","3H","4C"]
-} \ No newline at end of file
diff --git a/src/test/resources/accordion/SimpleUnsolvable.json b/src/test/resources/accordion/SimpleUnsolvable.json
deleted file mode 100644
index 2e1b9c3..0000000
--- a/src/test/resources/accordion/SimpleUnsolvable.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "accordion": ["AC","4S","AH","2S","AD","3S","4C","3H","2C","3D"]
-}
diff --git a/src/test/resources/alpha_star/ComplexSolvable.json b/src/test/resources/alpha_star/ComplexSolvable.json
deleted file mode 100644
index ab6b24e..0000000
--- a/src/test/resources/alpha_star/ComplexSolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["6C","3S","2C","3C","5C","5H","4H"],
- ["6S","4S","4C","5S","2D","5D"],
- ["6H","6D","2S","2H","3H","4D","3D"]
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/alpha_star/ComplexUnsolvable.json b/src/test/resources/alpha_star/ComplexUnsolvable.json
deleted file mode 100644
index 56ea441..0000000
--- a/src/test/resources/alpha_star/ComplexUnsolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["6C","2S","2C","3C","5C","5H","4H"],
- ["6S","4S","4C","5S","2D","5D"],
- ["6H","6D","3S","2H","3H","4D","3D"]
- ]
-}
diff --git a/src/test/resources/alpha_star/SimpleSolvable.json b/src/test/resources/alpha_star/SimpleSolvable.json
deleted file mode 100644
index 7994021..0000000
--- a/src/test/resources/alpha_star/SimpleSolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["6C","5S","5C","4C","3C","2S","2C"],
- ["6S","6D","5D","4D","3S","3D","2D"],
- ["6H","5H","4S","4H","3H","2H"]
- ]
-}
diff --git a/src/test/resources/alpha_star/SimpleUnsolvable.json b/src/test/resources/alpha_star/SimpleUnsolvable.json
deleted file mode 100644
index ac6741e..0000000
--- a/src/test/resources/alpha_star/SimpleUnsolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["2S","2C","3C","4C","5S","5C","6C"],
- ["2D","3D","4S","4D","5D","6S","6D"],
- ["2H","3S","3H","4H","5H","6H"]
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/bakers_dozen/ComplexSolvable.json b/src/test/resources/bakers_dozen/ComplexSolvable.json
deleted file mode 100644
index b953413..0000000
--- a/src/test/resources/bakers_dozen/ComplexSolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["AC","2S","AS","3H"],
- ["AD","2D","2H","AH"],
- ["3D","3C","2C","3S"]
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/bakers_dozen/ComplexUnsolvable.json b/src/test/resources/bakers_dozen/ComplexUnsolvable.json
deleted file mode 100644
index a8247c4..0000000
--- a/src/test/resources/bakers_dozen/ComplexUnsolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["AC","2S","AS","3C"],
- ["AD","2D","2H","AH"],
- ["3D","3H","2C","3S"]
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/bakers_dozen/SimpleSolvable.json b/src/test/resources/bakers_dozen/SimpleSolvable.json
deleted file mode 100644
index 7c00a71..0000000
--- a/src/test/resources/bakers_dozen/SimpleSolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["3S","2S","AS","AD"],
- ["3H","2D","2H","AH"],
- ["3D","3C","2C","AC"]
- ]
-}
diff --git a/src/test/resources/bakers_dozen/SimpleUnsolvable.json b/src/test/resources/bakers_dozen/SimpleUnsolvable.json
deleted file mode 100644
index 0b39a8d..0000000
--- a/src/test/resources/bakers_dozen/SimpleUnsolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["AS","2S","2D","3S"],
- ["AD","AH","2H","3H"],
- ["AC","2C","3C","3D"]
- ]
-}
diff --git a/src/test/resources/black_hole/ComplexSolvable.json b/src/test/resources/black_hole/ComplexSolvable.json
deleted file mode 100644
index 15488e9..0000000
--- a/src/test/resources/black_hole/ComplexSolvable.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "tableau piles": [
- ["5D","4D","3D","2D","AD"],
- ["5C","4C","3C","2C","4H"],
- ["AC","AH","2H","3H","5H"],
- ["2S","5S","4S","3S"]
- ],
- "hole": "AS"
-}
diff --git a/src/test/resources/black_hole/ComplexUnsolvable.json b/src/test/resources/black_hole/ComplexUnsolvable.json
deleted file mode 100644
index ed4ee99..0000000
--- a/src/test/resources/black_hole/ComplexUnsolvable.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "tableau piles": [
- ["5C","3C","2C","4C","AC"],
- ["5D","3D","2D","4D","AD"],
- ["5H","3H","4S","4H","AH"],
- ["5D","2D","2H","2S"]
- ],
- "hole": "AS"
-}
diff --git a/src/test/resources/black_hole/SimpleSolvable.json b/src/test/resources/black_hole/SimpleSolvable.json
deleted file mode 100644
index 3a7be18..0000000
--- a/src/test/resources/black_hole/SimpleSolvable.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "tableau piles": [
- ["AD","2D","3D","4D","5D"],
- ["AC","2C","3C","4C","5C"],
- ["AH","2H","3H","4H","5H"],
- ["2S","3S","4S","5S"]
- ],
- "hole": "AS"
-}
diff --git a/src/test/resources/black_hole/SimpleUnsolvable.json b/src/test/resources/black_hole/SimpleUnsolvable.json
deleted file mode 100644
index d6a5e7c..0000000
--- a/src/test/resources/black_hole/SimpleUnsolvable.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "tableau piles": [
- ["5D","4D","3D","2D","AD"],
- ["5C","4C","3C","2C","AC"],
- ["5H","4H","3H","2H","AH"],
- ["5S","4S","2S","3S"]
- ],
- "hole": "AS"
-}
diff --git a/src/test/resources/canfield/ComplexSolvable.json b/src/test/resources/canfield/ComplexSolvable.json
deleted file mode 100644
index 2a4c252..0000000
--- a/src/test/resources/canfield/ComplexSolvable.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "foundations": ["2C"],
- "tableau piles": [
- ["3D"],
- ["3H"],
- ["3S"]
- ],
- "reserve": ["AC","2S","3C"],
- "stock": ["AH","2H","AD","AS","2D"]
-} \ No newline at end of file
diff --git a/src/test/resources/canfield/ComplexUnsolvable.json b/src/test/resources/canfield/ComplexUnsolvable.json
deleted file mode 100644
index 297d06b..0000000
--- a/src/test/resources/canfield/ComplexUnsolvable.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "foundations": ["2C"],
- "tableau piles": [
- ["AS","3D"],
- ["AC","3H"],
- ["3S"]
- ],
- "reserve": ["AH","2S","3C"],
- "stock": ["AD","2H","2D"]
-} \ No newline at end of file
diff --git a/src/test/resources/canfield/SimpleSolvable.json b/src/test/resources/canfield/SimpleSolvable.json
deleted file mode 100644
index 3353b5c..0000000
--- a/src/test/resources/canfield/SimpleSolvable.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "foundations": ["2C"],
- "tableau piles": [
- ["2S"],
- ["AC"],
- ["3D"]
- ],
- "reserve": ["AH","3S"],
- "stock": ["2H","AS","3H","2D","3C","AD"]
-} \ No newline at end of file
diff --git a/src/test/resources/canfield/SimpleUnsolvable.json b/src/test/resources/canfield/SimpleUnsolvable.json
deleted file mode 100644
index 440c358..0000000
--- a/src/test/resources/canfield/SimpleUnsolvable.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "foundations": ["2C"],
- "tableau piles": [
- ["3D"],
- ["3H"],
- ["3S"]
- ],
- "reserve": ["2S","AS"],
- "stock": ["AC","2H","3C","AH","AD","2D"]
-} \ No newline at end of file
diff --git a/src/test/resources/flower_garden/ComplexSolvable.json b/src/test/resources/flower_garden/ComplexSolvable.json
deleted file mode 100644
index 1f1a6e6..0000000
--- a/src/test/resources/flower_garden/ComplexSolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["AH","2D","AC"],
- ["AD","2C","3D"],
- ["2H","AS","3H"]
- ],
- "reserve": ["3C","2S","3S"]
-}
diff --git a/src/test/resources/flower_garden/ComplexUnsolvable.json b/src/test/resources/flower_garden/ComplexUnsolvable.json
deleted file mode 100644
index be0ca64..0000000
--- a/src/test/resources/flower_garden/ComplexUnsolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["2H","2D","AC"],
- ["AD","2C","3D"],
- ["AH","AS","3H"]
- ],
- "reserve": ["3C","2S","3S"]
-}
diff --git a/src/test/resources/flower_garden/SimpleSolvable.json b/src/test/resources/flower_garden/SimpleSolvable.json
deleted file mode 100644
index 18c680d..0000000
--- a/src/test/resources/flower_garden/SimpleSolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["3C","2C","AC"],
- ["3D","2D","AD"],
- ["3H","3S","AH"]
- ],
- "reserve": ["2H","2S","AS"]
-}
diff --git a/src/test/resources/flower_garden/SimpleUnsolvable.json b/src/test/resources/flower_garden/SimpleUnsolvable.json
deleted file mode 100644
index e57e9ca..0000000
--- a/src/test/resources/flower_garden/SimpleUnsolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["AC","2C","3C"],
- ["AD","2D","3D"],
- ["AH","AS","3H"]
- ],
- "reserve": ["2H","2S","3S"]
-} \ No newline at end of file
diff --git a/src/test/resources/fortunes_favor/ComplexSolvable.json b/src/test/resources/fortunes_favor/ComplexSolvable.json
deleted file mode 100644
index f00d600..0000000
--- a/src/test/resources/fortunes_favor/ComplexSolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["2C","2D","4H"],
- ["4C","3D","3H"],
- ["2S","3C","4D"]
- ],
- "stock": ["2H","3S","4S"]
-}
diff --git a/src/test/resources/fortunes_favor/ComplexUnsolvable.json b/src/test/resources/fortunes_favor/ComplexUnsolvable.json
deleted file mode 100644
index 4f54b94..0000000
--- a/src/test/resources/fortunes_favor/ComplexUnsolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["2H","2D","4H"],
- ["2C","3D","3H"],
- ["2S","3C","4D"]
- ],
- "stock": ["4C","3S","4S"]
-}
diff --git a/src/test/resources/fortunes_favor/SimpleSolvable.json b/src/test/resources/fortunes_favor/SimpleSolvable.json
deleted file mode 100644
index 0891746..0000000
--- a/src/test/resources/fortunes_favor/SimpleSolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["2C","2D","2H"],
- ["3C","3D","3H"],
- ["4C","4D","4H"]
- ],
- "stock": ["4S","3S","2S"]
-}
diff --git a/src/test/resources/fortunes_favor/SimpleUnsolvable.json b/src/test/resources/fortunes_favor/SimpleUnsolvable.json
deleted file mode 100644
index 44d7359..0000000
--- a/src/test/resources/fortunes_favor/SimpleUnsolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["2C","2D","3C"],
- ["2H","3D","3H"],
- ["2S","4D","4H"]
- ],
- "stock": ["4C","3S","4S"]
-}
diff --git a/src/test/resources/free_cell/ComplexSolvable.json b/src/test/resources/free_cell/ComplexSolvable.json
deleted file mode 100644
index ca370ff..0000000
--- a/src/test/resources/free_cell/ComplexSolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["AC","2C","4C","3C"],
- ["AD","2D","4D","3D"],
- ["AH","2H","3H","4H"],
- ["AS","2S","3S","4S"]
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/free_cell/ComplexUnsolvable.json b/src/test/resources/free_cell/ComplexUnsolvable.json
deleted file mode 100644
index 48ac428..0000000
--- a/src/test/resources/free_cell/ComplexUnsolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["2S","2C","4D","3C"],
- ["2H","2D","4C","3D"],
- ["AH","AD","3S","4H"],
- ["AS","AC","3H","4S"]
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/free_cell/SimpleSolvable.json b/src/test/resources/free_cell/SimpleSolvable.json
deleted file mode 100644
index 1bebaf2..0000000
--- a/src/test/resources/free_cell/SimpleSolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["4C","3C","2C","AC"],
- ["4D","3D","2D","AD"],
- ["4H","3H","2H","AH"],
- ["4S","3S","2S","AS"]
- ]
-}
diff --git a/src/test/resources/free_cell/SimpleUnsolvable.json b/src/test/resources/free_cell/SimpleUnsolvable.json
deleted file mode 100644
index 8cdcc26..0000000
--- a/src/test/resources/free_cell/SimpleUnsolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["AC","2C","3C","4C"],
- ["AD","2D","3D","4D"],
- ["AH","2H","3H","4H"],
- ["AS","2S","3S","4S"]
- ]
-}
diff --git a/src/test/resources/gaps/ComplexSolvable.json b/src/test/resources/gaps/ComplexSolvable.json
deleted file mode 100644
index f9fcb41..0000000
--- a/src/test/resources/gaps/ComplexSolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "sequences": [
- ["4C","2S","2C",""],
- ["2D","3S","4D",""],
- ["4S","3C","3D",""],
- ["2H","3H","4H",""]
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/gaps/ComplexUnsolvable.json b/src/test/resources/gaps/ComplexUnsolvable.json
deleted file mode 100644
index 2c9de3e..0000000
--- a/src/test/resources/gaps/ComplexUnsolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "sequences": [
- ["2C","4S","4C",""],
- ["3S","2D","4D",""],
- ["2S","3C","3D",""],
- ["2H","3H","4H",""]
- ]
-}
diff --git a/src/test/resources/gaps/SimpleSolvable.json b/src/test/resources/gaps/SimpleSolvable.json
deleted file mode 100644
index 2e9cdfe..0000000
--- a/src/test/resources/gaps/SimpleSolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "sequences": [
- ["2C","4S","4C",""],
- ["2D","3S","4D",""],
- ["2S","3C","3D",""],
- ["2H","3H","4H",""]
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/gaps/SimpleUnsolvable.json b/src/test/resources/gaps/SimpleUnsolvable.json
deleted file mode 100644
index b0c0529..0000000
--- a/src/test/resources/gaps/SimpleUnsolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "sequences": [
- ["2C","3C","4C",""],
- ["3S","2D","4D",""],
- ["2S","4S","3D",""],
- ["2H","3H","4H",""]
- ]
-}
diff --git a/src/test/resources/klondike/ComplexSolvable.json b/src/test/resources/klondike/ComplexSolvable.json
deleted file mode 100644
index 8711780..0000000
--- a/src/test/resources/klondike/ComplexSolvable.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "tableau piles": [
- ["3d","2c","4c","2H"],
- ["Ah","3h","2S"],
- ["Ad","3C"],
- ["4S"]
- ],
- "stock": ["3S","AS","AC","2D","4H","4D"]
-} \ No newline at end of file
diff --git a/src/test/resources/klondike/ComplexUnsolvable.json b/src/test/resources/klondike/ComplexUnsolvable.json
deleted file mode 100644
index 7685ce1..0000000
--- a/src/test/resources/klondike/ComplexUnsolvable.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "tableau piles": [
- ["3d","2c","4c","2H"],
- ["Ah","3h","2S"],
- ["Ad","3C"],
- ["4S"]
- ],
- "stock": ["3S","4D","AC","2D","4H","AS"]
-} \ No newline at end of file
diff --git a/src/test/resources/klondike/SimpleSolvable.json b/src/test/resources/klondike/SimpleSolvable.json
deleted file mode 100644
index f54ebbb..0000000
--- a/src/test/resources/klondike/SimpleSolvable.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "tableau piles": [
- ["3d","2c","Ac","2H"],
- ["4h","3h","2S"],
- ["4d","3C"],
- ["AS"]
- ],
- "stock": ["3S","4S","4C","2D","AH","AD"]
-} \ No newline at end of file
diff --git a/src/test/resources/klondike/SimpleUnsolvable.json b/src/test/resources/klondike/SimpleUnsolvable.json
deleted file mode 100644
index 21a5854..0000000
--- a/src/test/resources/klondike/SimpleUnsolvable.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "tableau piles": [
- ["As","2c","2d","2H"],
- ["Ah","3h","2S"],
- ["Ad","3C"],
- ["4S"]
- ],
- "stock": ["3S","4D","AC","4C","4H","3D"]
-} \ No newline at end of file
diff --git a/src/test/resources/somerset/ComplexSolvable.json b/src/test/resources/somerset/ComplexSolvable.json
deleted file mode 100644
index b316c50..0000000
--- a/src/test/resources/somerset/ComplexSolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["2S","2C","AC"],
- ["2D","AD"],
- ["2H","AH"],
- ["AS"]
- ]
-}
diff --git a/src/test/resources/somerset/ComplexUnsolvable.json b/src/test/resources/somerset/ComplexUnsolvable.json
deleted file mode 100644
index 09d7864..0000000
--- a/src/test/resources/somerset/ComplexUnsolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["AS","AC","2C"],
- ["AD","2D"],
- ["AH","2H"],
- ["2S"]
- ]
-}
diff --git a/src/test/resources/somerset/SimpleSolvable.json b/src/test/resources/somerset/SimpleSolvable.json
deleted file mode 100644
index b316c50..0000000
--- a/src/test/resources/somerset/SimpleSolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["2S","2C","AC"],
- ["2D","AD"],
- ["2H","AH"],
- ["AS"]
- ]
-}
diff --git a/src/test/resources/somerset/SimpleUnsolvable.json b/src/test/resources/somerset/SimpleUnsolvable.json
deleted file mode 100644
index 09d7864..0000000
--- a/src/test/resources/somerset/SimpleUnsolvable.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "tableau piles": [
- ["AS","AC","2C"],
- ["AD","2D"],
- ["AH","2H"],
- ["2S"]
- ]
-}
diff --git a/src/test/resources/spanish_patience/ComplexSolvable.json b/src/test/resources/spanish_patience/ComplexSolvable.json
deleted file mode 100644
index c48ce47..0000000
--- a/src/test/resources/spanish_patience/ComplexSolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["AS", "2S", "AH"],
- ["AD", "2D", "2H"],
- ["2C", "AC"]
- ]
-}
diff --git a/src/test/resources/spanish_patience/ComplexUnsolvable.json b/src/test/resources/spanish_patience/ComplexUnsolvable.json
deleted file mode 100644
index ba9be59..0000000
--- a/src/test/resources/spanish_patience/ComplexUnsolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["AS", "2S", "AH"],
- ["AD", "2D", "2H"],
- ["AC", "2C"]
- ]
-}
diff --git a/src/test/resources/spanish_patience/SimpleSolvable.json b/src/test/resources/spanish_patience/SimpleSolvable.json
deleted file mode 100644
index eacad0e..0000000
--- a/src/test/resources/spanish_patience/SimpleSolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["2S", "AS", "AD"],
- ["2D", "2H", "AH"],
- ["2C", "AC"]
- ]
-}
diff --git a/src/test/resources/spanish_patience/SimpleUnsolvable.json b/src/test/resources/spanish_patience/SimpleUnsolvable.json
deleted file mode 100644
index 99a3140..0000000
--- a/src/test/resources/spanish_patience/SimpleUnsolvable.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "tableau piles": [
- ["AS", "2S", "2D"],
- ["AD", "AH", "2H"],
- ["AC", "2C"]
- ]
-}
diff --git a/src/test/resources/spider/ComplexSolvable.json b/src/test/resources/spider/ComplexSolvable.json
deleted file mode 100644
index c7d96e2..0000000
--- a/src/test/resources/spider/ComplexSolvable.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "tableau piles": [
- ["2D","AD","3D"],
- ["AC","2C","3C"],
- ["AS","2S","3S"],
- ["3H","2H","AH"]
- ],
- "stock": [
- "2C","3D","3H","3S",
- "AC","AD","AH","AS",
- "3C","2D","2H","2S"
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/spider/ComplexUnsolvable.json b/src/test/resources/spider/ComplexUnsolvable.json
deleted file mode 100644
index 2379c9a..0000000
--- a/src/test/resources/spider/ComplexUnsolvable.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "tableau piles": [
- ["2D","AD","3D"],
- ["AC","2C","3C"],
- ["AS","2S","3S"],
- ["3H","2H","AH"]
- ],
- "stock": [
- "3C","3D","3H","3S",
- "2C","2D","AH","AS",
- "AC","AD","2H","2S"
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/spider/SimpleSolvable.json b/src/test/resources/spider/SimpleSolvable.json
deleted file mode 100644
index f0b9b00..0000000
--- a/src/test/resources/spider/SimpleSolvable.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "tableau piles": [
- ["3C","2C","AC"],
- ["3D","2D","AD"],
- ["3H","2H","AH"],
- ["3S","2S","AS"]
- ],
- "stock": [
- "3C","2C","AC",
- "3D","2D","AD",
- "3H","2H","AH",
- "3S","2S","AS"
- ]
-}
diff --git a/src/test/resources/spider/SimpleUnsolvable.json b/src/test/resources/spider/SimpleUnsolvable.json
deleted file mode 100644
index d11a6dd..0000000
--- a/src/test/resources/spider/SimpleUnsolvable.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "tableau piles": [
- ["AC","AC","2C"],
- ["AD","AD","2D"],
- ["AH","AH","2H"],
- ["AS","AS","2S"]
- ],
- "stock": [
- "3C","3D","3H","3S",
- "2C","2D","2H","2S",
- "3C","3D","3H","3S"
- ]
-}
diff --git a/src/test/test_helper.cpp b/src/test/test_helper.cpp
deleted file mode 100644
index 6cc68aa..0000000
--- a/src/test/test_helper.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-//
-// Created by thecharlesblake on 12/26/17.
-//
-
-#include <gtest/gtest.h>
-
-#include "test_helper.h"
-#include "../main/game/search-state/game_state.h"
-#include "../main/solver/solver.h"
-#include "../main/input-output/input/json-parsing/json_helper.h"
-#include "../main/input-output/input/json-parsing/rules_parser.h"
-#include "../../lib/rapidjson/document.h"
-
-#define ASSERT_(t_f, statement) ASSERT_TRUE((statement) == (t_f))
-
-using namespace rapidjson;
-using std::vector;
-using std::ostream;
-
-typedef std::initializer_list<std::initializer_list<std::string>> string_il;
-typedef game_state::streamliner_options sos;
-
-
-bool test_helper::is_solvable(const std::string& input_file, const std::string& preset_type) {
- const Document in_doc = json_helper::get_file_json(input_file);
- const sol_rules rules = rules_parser::from_preset(preset_type);
-
- game_state gs(rules, in_doc, sos::NONE);
- solver sol(gs, 1000000);
-
- return sol.run().sol_type == solver::result::type::SOLVED;
-}
-
-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, string_il{
- {},
- {},
- {},
- {},
- {"4C","3C","2C","AC"},
- {"4H","3H","2H","AH"},
- {"4S","3S","2S","AS"},
- {"4D","3D","2D","AD"}
- });
-
- solver sol(gs, 1000000);
- sol.run();
-
- auto frontier = sol.get_frontier();
- auto i = std::begin(frontier);
-
- for (card c : cards) {
- i++;
- ASSERT_TRUE(i->mv.type == move::mtype::dominance);
- ASSERT_TRUE(gs.get_data()[i->mv.from].top_card() == c);
- ASSERT_TRUE(i->mv.to >= 0 && i->mv.to <= 4);
- gs.make_move(i->mv);
- }
- ASSERT_TRUE(i->child_moves.empty());
-}
-
-void test_helper::expected_moves_test(sol_rules sr,
- string_il piles,
- vector<move> exp_moves) {
- game_state gs(sr, piles);
- vector<move> actual_moves = gs.get_legal_moves();
-
- ASSERT_TRUE(moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-bool test_helper::moves_eq(vector<move>& exp_moves, vector<move>& actual_moves) {
- if (exp_moves.size() != actual_moves.size()) return false;
-
- for (move m : actual_moves) {
- auto it = find(begin(exp_moves), end(exp_moves), m);
- bool found = it != end(exp_moves);
-
- if (found) exp_moves.erase(it);
- else return false;
- }
-
- return true;
-}
-
-void test_helper::k_plus_stock_test
- ( sol_rules sr
- , string_il piles
- , vector<move> exp_moves
- , move m
- , pile::size_type stock_size
- , pile::size_type waste_size
- , card top_stock
- , card top_waste
- ) {
-
- game_state gs(sr, piles);
- vector<move> actual_moves = gs.get_legal_moves();
-
- ASSERT_TRUE(moves_eq(exp_moves, actual_moves)) << actual_moves;
-
- gs.make_move(m);
-
- ASSERT_EQ(gs.get_data()[gs.stock].size(), stock_size) << gs.get_data()[gs.stock].size();
- ASSERT_EQ(gs.get_data()[gs.waste].size(), waste_size) << gs.get_data()[gs.waste].size();
-
- if (top_stock == card())
- ASSERT_TRUE(gs.get_data()[gs.stock].empty());
- else
- ASSERT_EQ(gs.get_data()[gs.stock].top_card(), top_stock ) << gs.get_data()[gs.stock].top_card().to_string();
-
- if (top_waste == card())
- ASSERT_TRUE(gs.get_data()[gs.waste].empty());
- else
- ASSERT_EQ(gs.get_data()[gs.waste].top_card(), top_waste ) << gs.get_data()[gs.waste].top_card().to_string();
-
- gs.undo_move(m);
-
- ASSERT_EQ(gs.get_data(), game_state(sr, piles).get_data()) << gs;
-}
-
-uint8_t test_helper::cards_in_founds(game_state& gs) {
- uint8_t sz = 0;
- for (auto found : gs.foundations) {
- sz += gs.piles[found].size();
- }
- return sz;
-}
-
-ostream& operator <<(ostream& os, const move& m) {
- return os << "move:(" << int(m.from)
- << "," << int(m.to)
- << "," << int(m.count)
- << "," << m.reveal_move
- << ")";
-}
-
-ostream& operator <<(ostream& os, const vector<move>& moves) {
- for (const move m : moves) {
- os << m << ",\n";
- }
- return os;
-}
diff --git a/src/test/test_helper.h b/src/test/test_helper.h
deleted file mode 100644
index 89d28cb..0000000
--- a/src/test/test_helper.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Created by thecharlesblake on 12/26/17.
-//
-
-#ifndef SOLVITAIRE_TEST_HELPER_H
-#define SOLVITAIRE_TEST_HELPER_H
-
-#include <string>
-
-#include "../main/game/sol_rules.h"
-#include "../main/game/card.h"
-#include "../main/game/pile.h"
-#include "../main/game/move.h"
-#include "../main/game/search-state/game_state.h"
-
-class test_helper {
-public:
- static bool is_solvable(const std::string&, const std::string&);
- static void run_foundations_dominance_test(sol_rules::build_policy policy,
- std::vector<card> cards);
- static void expected_moves_test(sol_rules sr, std::initializer_list<std::initializer_list<std::string>>,
- std::vector<move>);
- static void k_plus_stock_test
- ( sol_rules sr
- , std::initializer_list<std::initializer_list<std::string>>
- , std::vector<move>
- , move
- , pile::size_type
- , pile::size_type
- , card
- , card
- );
- static bool moves_eq(std::vector<move>&, std::vector<move>&);
- static uint8_t cards_in_founds(game_state&);
-};
-
-std::ostream& operator <<(std::ostream&, const move&);
-std::ostream& operator <<(std::ostream&, const std::vector<move>&);
-
-
-#endif //SOLVITAIRE_TEST_HELPER_H
diff --git a/src/test/unit_tests/built_group_move_gen_test.cpp b/src/test/unit_tests/built_group_move_gen_test.cpp
deleted file mode 100644
index 5e3a492..0000000
--- a/src/test/unit_tests/built_group_move_gen_test.cpp
+++ /dev/null
@@ -1,313 +0,0 @@
-//
-// Created by thecharlesblake on 1/11/18.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-#include "../../main/game/search-state/game_state.h"
-#include "../../main/game/sol_rules.h"
-
-typedef sol_rules::build_policy pol;
-typedef sol_rules::spaces_policy s_pol;
-typedef sol_rules::built_group_type bgt;
-
-using std::vector;
-using std::ostream;
-using std::initializer_list;
-
-TEST(BuiltGroupMoveGen, SameSuitEmpty) {
- sol_rules sr;
- sr.tableau_pile_count = 5;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
-
- test_helper::expected_moves_test(
- sr,
- {
- {},
- {"3C", "2C", "AC"}, // Same suit
- {"3H", "2S", "AH"}, // Red black
- {"3D", "2D", "AS"}, // Any suit
- {}
- },
- {
- // Regular moves
- move(move::mtype::regular, 1, 0, 1),
- move(move::mtype::regular, 2, 0, 1),
- move(move::mtype::regular, 3, 0, 1),
- move(move::mtype::regular, 1, 4, 1),
- move(move::mtype::regular, 2, 4, 1),
- move(move::mtype::regular, 3, 4, 1),
-
- // Built group moves
- move(move::mtype::built_group, 1, 0, 2),
- move(move::mtype::built_group, 1, 0, 3),
- move(move::mtype::built_group, 1, 4, 2),
- move(move::mtype::built_group, 1, 4, 3)
- }
- );
-}
-
-TEST(BuiltGroupMoveGen, RedBlackEmpty) {
- sol_rules sr;
- sr.tableau_pile_count = 5;
- sr.built_group_pol = pol::RED_BLACK;
- sr.move_built_group = bgt::YES;
-
- test_helper::expected_moves_test(
- sr,
- {
- {},
- {"3C", "2C", "AC"}, // Same suit
- {"3H", "2S", "AH"}, // Red black
- {"3D", "2D", "AS"}, // Any suit
- {}
- },
- {
- // Regular moves
- move(move::mtype::regular, 1, 0, 1),
- move(move::mtype::regular, 2, 0, 1),
- move(move::mtype::regular, 3, 0, 1),
- move(move::mtype::regular, 1, 4, 1),
- move(move::mtype::regular, 2, 4, 1),
- move(move::mtype::regular, 3, 4, 1),
-
- // Built group moves
- move(move::mtype::built_group, 2, 0, 2),
- move(move::mtype::built_group, 2, 0, 3),
- move(move::mtype::built_group, 2, 4, 2),
- move(move::mtype::built_group, 2, 4, 3),
-
- move(move::mtype::built_group, 3, 0, 2),
- move(move::mtype::built_group, 3, 4, 2)
- }
- );
-}
-
-TEST(BuiltGroupMoveGen, AnySuitEmpty) {
- sol_rules sr;
- sr.tableau_pile_count = 5;
- sr.built_group_pol = pol::ANY_SUIT;
- sr.move_built_group = bgt::YES;
-
- test_helper::expected_moves_test(
- sr,
- {
- {},
- {"3C", "2C", "AC"}, // Same suit
- {"3H", "2S", "AH"}, // Red black
- {"3D", "2D", "AS"}, // Any suit
- {}
- },
- {
- // Regular moves
- move(move::mtype::regular, 1, 0, 1),
- move(move::mtype::regular, 2, 0, 1),
- move(move::mtype::regular, 3, 0, 1),
- move(move::mtype::regular, 1, 4, 1),
- move(move::mtype::regular, 2, 4, 1),
- move(move::mtype::regular, 3, 4, 1),
-
- // Built group moves
- move(move::mtype::built_group, 1, 0, 2),
- move(move::mtype::built_group, 1, 0, 3),
- move(move::mtype::built_group, 1, 4, 2),
- move(move::mtype::built_group, 1, 4, 3),
-
- move(move::mtype::built_group, 2, 0, 2),
- move(move::mtype::built_group, 2, 0, 3),
- move(move::mtype::built_group, 2, 4, 2),
- move(move::mtype::built_group, 2, 4, 3),
-
- move(move::mtype::built_group, 3, 0, 2),
- move(move::mtype::built_group, 3, 0, 3),
- move(move::mtype::built_group, 3, 4, 2),
- move(move::mtype::built_group, 3, 4, 3),
- }
- );
-}
-
-TEST(BuiltGroupMoveGen, CantMove) {
- sol_rules sr;
- sr.tableau_pile_count = 5;
- sr.built_group_pol = pol::ANY_SUIT;
- sr.move_built_group = bgt::NO;
-
- test_helper::expected_moves_test(
- sr,
- {
- {},
- {"3C", "2C", "AC"}, // Same suit
- {"3H", "2S", "AH"}, // Red black
- {"3D", "2D", "AS"}, // Any suit
- {}
- },
- {
- // Regular moves
- move(move::mtype::regular, 1, 0, 1),
- move(move::mtype::regular, 2, 0, 1),
- move(move::mtype::regular, 3, 0, 1),
- move(move::mtype::regular, 1, 4, 1),
- move(move::mtype::regular, 2, 4, 1),
- move(move::mtype::regular, 3, 4, 1)
- }
- );
-}
-
-TEST(BuiltGroupMoveGen, SameSuitOccupied) {
- sol_rules sr;
- sr.tableau_pile_count = 6;
- sr.build_pol = pol::SAME_SUIT;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
-
- test_helper::expected_moves_test(
- sr,
- {
- {"4C"},
- {"3C", "2C", "AC"}, // Same suit
- {"3H", "2S", "AH"}, // Red black
- {"3D", "2D", "AS"}, // Any suit
- {},
- {"3C"}
- },
- {
- // Regular moves
- move(move::mtype::regular, 1, 4, 1),
- move(move::mtype::regular, 2, 4, 1),
- move(move::mtype::regular, 3, 4, 1),
- move(move::mtype::regular, 5, 0, 1),
-
- // Built group moves
- move(move::mtype::built_group, 1, 0, 3),
- move(move::mtype::built_group, 1, 4, 2),
- move(move::mtype::built_group, 1, 4, 3),
- move(move::mtype::built_group, 1, 5, 2)
- }
- );
-}
-
-TEST(BuiltGroupMoveGen, RedBlackOccupied) {
- sol_rules sr;
- sr.tableau_pile_count = 6;
- sr.build_pol = pol::RED_BLACK;
- sr.built_group_pol = pol::RED_BLACK;
- sr.move_built_group = bgt::YES;
-
- test_helper::expected_moves_test(
- sr,
- {
- {"4C"},
- {"3C", "2C", "AC"}, // Same suit
- {"3H", "2S", "AH"}, // Red black
- {"3D", "2D", "AS"}, // Any suit
- {},
- {"3C"}
- },
- {
- // Regular moves
- move(move::mtype::regular, 1, 4, 1),
- move(move::mtype::regular, 2, 4, 1),
- move(move::mtype::regular, 3, 4, 1),
-
- // Built group moves
- move(move::mtype::built_group, 2, 0, 3),
- move(move::mtype::built_group, 2, 4, 2),
- move(move::mtype::built_group, 2, 4, 3),
- move(move::mtype::built_group, 3, 4, 2),
- move(move::mtype::built_group, 3, 5, 2)
- }
- );
-}
-
-TEST(BuiltGroupMoveGen, AnySuitOccupied) {
- sol_rules sr;
- sr.tableau_pile_count = 6;
- sr.build_pol = pol::ANY_SUIT;
- sr.built_group_pol = pol::ANY_SUIT;
- sr.move_built_group = bgt::YES;
-
- test_helper::expected_moves_test(
- sr,
- {
- {"4C"},
- {"3C", "2C", "AC"}, // Same suit
- {"3H", "2S", "AH"}, // Red black
- {"3D", "2D", "AS"}, // Any suit
- {},
- {"3C"}
- },
- {
- // Regular moves
- move(move::mtype::regular, 1, 4, 1),
- move(move::mtype::regular, 2, 4, 1),
- move(move::mtype::regular, 3, 4, 1),
- move(move::mtype::regular, 5, 0, 1),
-
- // Built group moves
- move(move::mtype::built_group, 1, 0, 3),
- move(move::mtype::built_group, 2, 0, 3),
- move(move::mtype::built_group, 3, 0, 3),
-
- move(move::mtype::built_group, 1, 4, 2),
- move(move::mtype::built_group, 1, 4, 3),
-
- move(move::mtype::built_group, 2, 4, 2),
- move(move::mtype::built_group, 2, 4, 3),
-
- move(move::mtype::built_group, 3, 4, 2),
- move(move::mtype::built_group, 3, 4, 3),
-
- move(move::mtype::built_group, 1, 5, 2),
- move(move::mtype::built_group, 2, 5, 2),
- move(move::mtype::built_group, 3, 5, 2)
- }
- );
-}
-
-TEST(BuiltGroupMoveGen, KingsOnly) {
- sol_rules sr;
- sr.tableau_pile_count = 5;
- sr.build_pol = pol::SAME_SUIT;
- sr.built_group_pol = pol::RED_BLACK;
- sr.move_built_group = bgt::YES;
- sr.spaces_pol = s_pol::KINGS;
-
- test_helper::expected_moves_test(
- sr,
- {
- {},
- {"KC", "QC", "JC"}, // Same suit
- {"KH", "QS", "JH"}, // Red black
- {"KD", "QD", "JS"}, // Any suit
- {}
- },
- {
- // Built group moves
- move(move::mtype::built_group, 2, 0, 3),
- move(move::mtype::built_group, 2, 4, 3)
- }
- );
-}
-
-TEST(BuiltGroupMoveGen, NoBuild) {
- sol_rules sr;
- sr.tableau_pile_count = 5;
- sr.build_pol = pol::SAME_SUIT;
- sr.built_group_pol = pol::RED_BLACK;
- sr.move_built_group = bgt::YES;
- sr.spaces_pol = s_pol::NO_BUILD;
-
- test_helper::expected_moves_test(
- sr,
- {
- {},
- {"KC", "QC", "JC"}, // Same suit
- {"KH", "QS", "JH"}, // Red black
- {"KD", "QD", "JS"}, // Any suit
- {}
- },
- {}
- );
-}
diff --git a/src/test/unit_tests/card_test.cpp b/src/test/unit_tests/card_test.cpp
deleted file mode 100644
index 346dff9..0000000
--- a/src/test/unit_tests/card_test.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// Created by thecharlesblake on 1/11/18.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-#include "../../main/game/card.h"
-
-TEST(Card, Rank) {
- for (card::rank_t r = 1; r <= 13; r++) {
- card::suit_t s = card::suit::Clubs;
- card c(s, r);
- ASSERT_EQ(r, c.get_rank());
- }
-}
-
-TEST(Card, Suit) {
- for (card::suit_t s : {
- card::suit::Clubs,
- card::suit::Hearts,
- card::suit::Spades,
- card::suit::Diamonds
- }) {
- card::rank_t r = 1;
- card c(s, r);
- ASSERT_EQ(s, c.get_suit());
- }
-}
-
-TEST(Card, Colour) {
- card::rank_t r = 1;
-
- for (card::suit_t s : {
- card::suit::Clubs,
- card::suit::Spades
- }) {
- card c(s, r);
- ASSERT_EQ(card::colour::Black, c.get_colour());
- }
-
- for (card::suit_t s : {
- card::suit::Hearts,
- card::suit::Diamonds
- }) {
- card c(s, r);
- ASSERT_EQ(card::colour::Red, c.get_colour());
- }
-}
-
-TEST(Card, EqOps) {
- for (card::rank_t r = 1; r <= 13; r++) {
- for (card::suit_t s : {
- card::suit::Clubs,
- card::suit::Hearts,
- card::suit::Spades,
- card::suit::Diamonds
- }) {
- card a(s, r);
- card b(s, r);
- ASSERT_TRUE (a == b);
- ASSERT_FALSE(a != b);
- }
- }
-}
-
-TEST(Card, RelativeOps) {
- for (card::rank_t r = 1; r <= 12; r++) {
- for (card::suit_t s : {
- card::suit::Clubs,
- card::suit::Hearts,
- card::suit::Spades,
- card::suit::Diamonds
- }) {
- card a(s, r);
- card b(s, card::rank_t(r+1));
- ASSERT_TRUE (a < b);
- ASSERT_TRUE (a <= b);
- ASSERT_FALSE(a > b);
- ASSERT_FALSE(a >= b);
- }
- }
-}
-
-TEST(Card, StringConstructor) {
- ASSERT_EQ(card(card::suit::Spades , card::rank_t(1) ), card("AS" ));
- ASSERT_EQ(card(card::suit::Clubs , card::rank_t(1) ), card("Ac" ));
- ASSERT_EQ(card(card::suit::Diamonds, card::rank_t(5) ), card("5D" ));
- ASSERT_EQ(card(card::suit::Hearts , card::rank_t(11)), card("11H"));
- ASSERT_EQ(card(card::suit::Spades , card::rank_t(11)), card("JS" ));
- ASSERT_EQ(card(card::suit::Clubs , card::rank_t(13)), card("kc" ));
-}
diff --git a/src/test/unit_tests/deal_parser_test.cpp b/src/test/unit_tests/deal_parser_test.cpp
deleted file mode 100644
index db2bd31..0000000
--- a/src/test/unit_tests/deal_parser_test.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// Created by thecharlesblake on 1/11/18.
-//
-
-#include <gtest/gtest.h>
-
-#include "../../../lib/rapidjson/stringbuffer.h"
-#include "../../../lib/rapidjson/document.h"
-
-#include "../../main/input-output/input/json-parsing/deal_parser.h"
-#include "../../main/input-output/input/json-parsing/json_helper.h"
-
-using namespace std;
-using namespace rapidjson;
-
-void run_deal_parser_test(bool, const char*);
-
-TEST(DealParser, SimpleTableauLetter) {
- run_deal_parser_test(true, R"(
-{
- "tableau piles": [
- ["AS"]
- ]
-}
-)");
-}
-
-TEST(DealParser, SimpleTableauNumber) {
- run_deal_parser_test(true, R"(
-{
- "tableau piles": [
- ["1S"]
- ]
-}
-)");
-}
-
-TEST(DealParser, IllegalTableauNumber) {
- run_deal_parser_test(false, R"(
-{
- "tableau piles": [
- ["14S"]
- ]
-}
-)");
-}
-
-TEST(DealParser, IllegalTableauSuit) {
- run_deal_parser_test(false, R"(
-{
- "tableau piles": [
- ["14A"]
- ]
-}
-)");
-}
-
-TEST(DealParser, SimpleTableauCase) {
- run_deal_parser_test(true, R"(
-{
- "tableau piles": [
- ["kc"]
- ]
-}
-)");
-}
-
-TEST(DealParser, AdvancedTableau) {
- run_deal_parser_test(true, R"(
-{
- "tableau piles": [
- ["5S","13C","4C","3C","2S","2c"],
- ["5D","qD","3S","1d","2D"],
- ["5H","4S","JH","3h","2H"]
- ]
-}
-)");
-}
-
-TEST(DealParser, Hole) {
- run_deal_parser_test(true, R"(
-{
- "tableau piles": [
- ["5S","13C","4C"]
- ],
- "hole": "qD"
-}
-)");
-}
-
-TEST(DealParser, Stock) {
- run_deal_parser_test(true, R"(
-{
- "tableau piles": [
- ["5S","13C","4C"]
- ],
- "stock": ["1S","JC","7H"]
-}
-)");
-}
-
-TEST(DealParser, Waste) {
- run_deal_parser_test(true, R"(
-{
- "tableau piles": [
- ["5S","13C","4C"]
- ],
- "waste": ["1S","JC","7H"]
-}
-)");
-}
-
-TEST(DealParser, IllegalPileType) {
- run_deal_parser_test(false, R"(
-{
- "tableau piles": [
- ["5S","13C","4C"]
- ],
- "other": ["1S","JC","7H"]
-}
-)");
-}
-
-void run_deal_parser_test(bool validity, const char* json) {
- Document in_doc;
- in_doc.Parse(json);
- if (in_doc.HasParseError()) {
- throw runtime_error("invalid json");
- }
-
- Document val_doc;
- val_doc.Parse(deal_parser::deal_schema_json().c_str());
- SchemaDocument sd(val_doc);
- SchemaValidator validator(sd);
- bool acc = in_doc.Accept(validator);
- if (acc) {
- ASSERT_TRUE(validity == acc) << "JSON accepted when it should not have "
- "been:\n" << json;
- } else {
- ASSERT_TRUE(validity == acc) << json_helper::schema_err_str(validator)
- << "\n" << json;
- }
-}
diff --git a/src/test/unit_tests/face_up_cards_test.cpp b/src/test/unit_tests/face_up_cards_test.cpp
deleted file mode 100644
index 1311958..0000000
--- a/src/test/unit_tests/face_up_cards_test.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-//
-// Created by thecharlesblake on 1/11/18.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-#include "../../main/game/search-state/game_state.h"
-#include "../../main/game/sol_rules.h"
-#include "../../main/game/global_cache.h"
-
-typedef sol_rules::build_policy pol;
-typedef sol_rules::face_up_policy fu;
-typedef move::mtype mt;
-typedef sol_rules::built_group_type bgt;
-
-using std::vector;
-using std::ostream;
-
-typedef std::initializer_list<std::initializer_list<std::string>> string_il;
-
-#define ASSERT_FACE_UP(card) ASSERT_FALSE(card.is_face_down()) << card.to_string() << " should be face up"
-#define ASSERT_FACE_DOWN(card) ASSERT_TRUE(card.is_face_down()) << card.to_string() << " should be face down"
-
-
-TEST(FaceUpCards, CapsFaceUpIfFaceUpNotAll) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.build_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::TOP_CARDS;
-
- string_il piles = {
- {"3S"},
- {"2s","AS"},
- {}
- };
-
- game_state gs(sr, piles);
-
- ASSERT_FACE_UP(gs.get_data()[0][0]);
- ASSERT_FACE_UP(gs.get_data()[1][0]);
- ASSERT_FACE_DOWN(gs.get_data()[1][1]);
-}
-
-TEST(FaceUpCards, IgnoreCapsIfFaceUpAll) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.build_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::ALL;
-
- string_il piles = {
- {"3S"},
- {"2s","AS"},
- {}
- };
-
- game_state gs(sr, piles);
-
- ASSERT_FACE_UP(gs.get_data()[0][0]);
- ASSERT_FACE_UP(gs.get_data()[1][0]);
- ASSERT_FACE_UP(gs.get_data()[1][1]);
-}
-
-TEST(FaceUpCards, MoveTurnsFaceUp) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.build_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::TOP_CARDS;
-
- string_il piles = {
- {"4S"},
- {"3s","AS"}, // from
- {"2S"} // to
- };
-
- test_helper::expected_moves_test(
- sr,
- piles,
- {
- // Regular moves
- move(move::mtype::regular, 1, 2, 1, true)
- }
- );
-
- game_state gs(sr, piles);
- gs.make_move(move(mt::regular, 1, 2, 1, true));
-
- ASSERT_FACE_UP(gs.get_data()[0][0]);
- ASSERT_FACE_UP(gs.get_data()[1][0]);
- ASSERT_FACE_UP(gs.get_data()[2][0]);
-}
-
-TEST(FaceUpCards, BuiltGroupMoveTurnsFaceUp) {
- sol_rules sr;
- sr.tableau_pile_count = 2;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.build_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::TOP_CARDS;
-
- string_il piles = {
- {"3s","2S","AS"}, // from
- {} // to
- };
-
- test_helper::expected_moves_test(
- sr,
- piles,
- {
- // Regular moves
- move(move::mtype::regular, 0, 1, 1, false),
- // Built-group moves
- move(move::mtype::built_group, 0, 1, 2, true)
- }
- );
-
- game_state gs(sr, piles);
- gs.make_move(move(mt::built_group, 0, 1, 2, true));
-
- ASSERT_FACE_UP(gs.get_data()[0][0]);
- ASSERT_FACE_UP(gs.get_data()[1][0]);
- ASSERT_FACE_UP(gs.get_data()[1][1]);
-}
-
-TEST(FaceUpCards, MoveAlreadyFaceUpNoChange) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.build_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::TOP_CARDS;
-
- string_il piles = {
- {"4S"},
- {"3s","AS"}, // from
- {"2S"} // to
- };
-
- test_helper::expected_moves_test(
- sr,
- piles,
- {
- // Regular moves
- move(move::mtype::regular, 1, 2, 1, true)
- }
- );
-
- game_state gs(sr, piles);
- gs.make_move(move(mt::regular, 1, 2, 1, true));
-
- ASSERT_FACE_UP(gs.get_data()[0][0]);
- ASSERT_FACE_UP(gs.get_data()[1][0]);
- ASSERT_FACE_UP(gs.get_data()[2][0]);
-}
-
-TEST(FaceUpCards, FaceDownNoBuiltGroup) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.build_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::TOP_CARDS;
-
- test_helper::expected_moves_test(
- sr,
- {
- {"4S"},
- {"3s","AS"},
- {"2S"}
- },
- {
- // Regular moves
- move(move::mtype::regular, 1, 2, 1, true)
- }
- );
-}
-
-TEST(FaceUpCards, FaceUpBuiltGroup) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.build_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::TOP_CARDS;
-
- test_helper::expected_moves_test(
- sr,
- {
- {"3S"},
- {"2S","AS"},
- {}
- },
- {
- // Regular moves
- move(mt::regular, 1, 2, 1),
-
- // Built group moves
- move(mt::built_group, 1, 0, 2),
- move(mt::built_group, 1, 2, 2)
- }
- );
-}
-
-TEST(FaceUpCards, FaceUpBuiltGroup2Not3) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.build_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::TOP_CARDS;
-
- test_helper::expected_moves_test(
- sr,
- {
- {"4S"},
- {"3s","2S","AS"},
- {"3S"}
- },
- {
- // Regular moves
- move(mt::regular, 2, 0, 1, false),
-
- // Built group moves
- move(mt::built_group, 1, 2, 2, true)
- }
- );
-}
-
-TEST(FaceUpCards, UndoTurnsBackFaceDown) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.build_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::TOP_CARDS;
-
- string_il piles = {
- {"3S"},
- {"2s","AS"}, // from
- {} // to
- };
-
- game_state gs(sr, piles);
- move m = move(mt::regular, 1, 2, 1, true);
- gs.make_move(m);
- gs.undo_move(m);
-
- ASSERT_FACE_UP(gs.get_data()[0][0]);
- ASSERT_FACE_UP(gs.get_data()[1][0]);
- ASSERT_FACE_DOWN(gs.get_data()[1][1]);
-}
-
-TEST(FaceUpCards, UndoBuiltGroupTurnsBackFaceDown) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.built_group_pol = pol::SAME_SUIT;
- sr.build_pol = pol::SAME_SUIT;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::TOP_CARDS;
-
- string_il piles = {
- {"4S"},
- {"3s","2S","AS"}, // from
- {} // to
- };
-
- game_state gs(sr, piles);
- move m = move(mt::built_group, 1, 2, 2, true);
- gs.make_move(m);
- gs.undo_move(m);
-
- ASSERT_FACE_UP(gs.get_data()[0][0]);
- ASSERT_FACE_UP(gs.get_data()[1][0]);
- ASSERT_FACE_UP(gs.get_data()[1][1]);
- ASSERT_FACE_DOWN(gs.get_data()[1][2]);
-}
-
-TEST(FaceUpCards, CacheEncodesFaceDown) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.built_group_pol = pol::RED_BLACK;
- sr.build_pol = pol::RED_BLACK;
- sr.move_built_group = bgt::YES;
- sr.face_up = fu::TOP_CARDS;
-
- string_il piles = {
- {"2C"},
- {"2s","AH"},
- {}
- };
-
- game_state gs(sr, piles);
- lru_cache cache(gs, 1000);
- bool new_state;
-
- gs.make_move(move(mt::regular, 1, 2, 1, true));
- new_state = cache.insert(gs).second;
- ASSERT_TRUE(new_state) << "AH to empty pile";
-
- gs.make_move(move(mt::regular, 2, 1, 1, false));
- new_state = cache.insert(gs).second;
- ASSERT_TRUE(new_state) << "AH back to face-up 2S";
-
- gs.make_move(move(mt::regular, 1, 0, 1, false));
- new_state = cache.insert(gs).second;
- ASSERT_TRUE(new_state) << "AH to 2C";
-
- gs.make_move(move(mt::regular, 0, 1, 1, false));
- new_state = cache.insert(gs).second;
- ASSERT_FALSE(new_state) << "AH to 2S";
-}
diff --git a/src/test/unit_tests/foundations_dominance_test.cpp b/src/test/unit_tests/foundations_dominance_test.cpp
deleted file mode 100644
index 8fdc285..0000000
--- a/src/test/unit_tests/foundations_dominance_test.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Created by thecharlesblake on 1/11/18.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-#include "../../main/game/search-state/game_state.h"
-#include "../../main/game/global_cache.h"
-
-typedef sol_rules::build_policy pol;
-
-TEST(FoundationsDominance, SameSuit) {
- test_helper::run_foundations_dominance_test(pol::SAME_SUIT, {
- "AC","2C","3C","4C","AH","2H","3H","4H","AS","2S","3S","4S","AD",
- "2D","3D","4D"});
-}
-
-TEST(FoundationsDominance, RedBlack) {
- test_helper::run_foundations_dominance_test(pol::RED_BLACK, {
- "AC","2C","AH","2H","AS","3H","2S","AD","3C","4H","3S","2D","4C",
- "4S","3D","4D"});
-}
-
-TEST(FoundationsDominance, AnySuit) {
- test_helper::run_foundations_dominance_test(pol::ANY_SUIT, {
- "AC","2C","AH","2H","AS","2S","AD","3C","3H","3S","2D","4C","4H",
- "4S","3D","4D"});
-} \ No newline at end of file
diff --git a/src/test/unit_tests/global_cache_test.cpp b/src/test/unit_tests/global_cache_test.cpp
deleted file mode 100644
index 93ef105..0000000
--- a/src/test/unit_tests/global_cache_test.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// Created by thecharlesblake on 1/11/18.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-#include "../../main/game/search-state/game_state.h"
-#include "../../main/game/global_cache.h"
-
-typedef sol_rules::build_policy pol;
-typedef std::initializer_list<std::initializer_list<std::string>> string_il;
-
-TEST(GlobalCache, CommutativeTableauPiles) {
- sol_rules rules;
- rules.tableau_pile_count = 3;
- rules.build_pol = sol_rules::build_policy::SAME_SUIT;
- game_state gs(rules, string_il{{},{},{}});
- lru_cache cache(gs, 1000);
-
- cache.insert (game_state(rules, {{"AC"},{"2D"},{"3H"}}));
- ASSERT_TRUE (cache.contains(game_state(rules, {{"2D"},{"3H"},{"AC"}})));
- ASSERT_FALSE(cache.contains(game_state(rules, {{"3H"},{"2D"},{"3H"}})));
-
- // Test with empty piles
- cache.clear();
- cache.insert (game_state(rules, {{"4C"},{"5D"},{}}));
- ASSERT_TRUE (cache.contains(game_state(rules, {{},{"4C"},{"5D"}})));
- ASSERT_FALSE(cache.contains(game_state(rules, {{},{"4C"},{}})));
-
- // Test with piles of size > 1
- cache.clear();
- cache.insert (game_state(rules, {{"6C","7D"},{"8C"},{"9D"}}));
- ASSERT_TRUE (cache.contains(game_state(rules, {{"8C"},{"6C","7D"},{"9D"}})));
- ASSERT_FALSE(cache.contains(game_state(rules, {{"8C"},{"6C","KD"},{"9D"}})));
-}
-
-TEST(GlobalCache, CommutativeReserve) {
- sol_rules rules;
- rules.reserve_size = 3;
- rules.build_pol = sol_rules::build_policy::SAME_SUIT;
- game_state gs(rules, string_il{{},{},{}});
- lru_cache cache(gs, 1000);
-
- cache.insert (game_state(rules, {{"AC"},{"2D"},{"3H"}}));
- ASSERT_TRUE (cache.contains(game_state(rules, {{"2D"},{"3H"},{"AC"}})));
- ASSERT_FALSE(cache.contains(game_state(rules, {{"3H"},{"2D"},{"3H"}})));
-
- // Test with empty piles
- cache.clear();
- cache.insert (game_state(rules, {{"4C"},{"5D"},{}}));
- ASSERT_TRUE (cache.contains(game_state(rules, {{},{"4C"},{"5D"}})));
- ASSERT_FALSE(cache.contains(game_state(rules, {{},{"4C"},{}})));
-
- // Test with piles of size > 1
- cache.clear();
- cache.insert (game_state(rules, {{"6C","7D"},{"8C"},{"9D"}}));
- ASSERT_TRUE (cache.contains(game_state(rules, {{"8C"},{"6C","7D"},{"9D"}})));
- ASSERT_FALSE(cache.contains(game_state(rules, {{"8C"},{"6C","KD"},{"9D"}})));
-}
-
-TEST(GlobalCache, CommutativeCells) {
- sol_rules rules;
- rules.cells = 3;
- rules.build_pol = sol_rules::build_policy::SAME_SUIT;
- game_state gs(rules, string_il{{},{},{}});
- lru_cache cache(gs, 1000);
-
- cache.insert (game_state(rules, {{"AC"},{"2D"},{"3H"}}));
- ASSERT_TRUE (cache.contains(game_state(rules, {{"2D"},{"3H"},{"AC"}})));
- ASSERT_FALSE(cache.contains(game_state(rules, {{"3H"},{"2D"},{"3H"}})));
-
- // Test with empty piles
- cache.clear();
- cache.insert (game_state(rules, {{"4C"},{"5D"},{}}));
- ASSERT_TRUE (cache.contains(game_state(rules, {{},{"4C"},{"5D"}})));
- ASSERT_FALSE(cache.contains(game_state(rules, {{},{"4C"},{}})));
-}
diff --git a/src/test/unit_tests/k_plus_stock_test.cpp b/src/test/unit_tests/k_plus_stock_test.cpp
deleted file mode 100644
index dcd4410..0000000
--- a/src/test/unit_tests/k_plus_stock_test.cpp
+++ /dev/null
@@ -1,426 +0,0 @@
-//
-// Created by thecharlesblake on 1/11/18.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-#include "../../main/game/search-state/game_state.h"
-#include "../../main/game/sol_rules.h"
-
-typedef sol_rules::build_policy pol;
-typedef sol_rules::stock_deal_type sdt;
-
-using std::vector;
-using std::ostream;
-using std::initializer_list;
-
-
-TEST(KPlusStock, NoRedealExact) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = false;
- sr.stock_deal_count = 3;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2H","2D","3S","AD","2S","3C","AC","AH","AS"},
- {},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 4, 3),
- move(move::mtype::stock_k_plus, 0, 3, 9),
- },
- move(move::mtype::stock_k_plus, 0, 3, 9),
- 0, 8,
- card(), "2D"
- );
-}
-
-TEST(KPlusStock, NoRedealOneExtra) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = false;
- sr.stock_deal_count = 3;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2H","AD","2S","3C","AC","AH","AS"},
- {},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 4, 3),
- move(move::mtype::stock_k_plus, 0, 3, 7),
- },
- move(move::mtype::stock_k_plus, 0, 3, 7),
- 0, 6,
- card(), "AD"
- );
-}
-
-TEST(KPlusStock, NoRedealTwoExtra) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = false;
- sr.stock_deal_count = 3;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2S","2H","AD","2D","3C","AC","AH","AS"},
- {},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 4, 3)
- },
- move(move::mtype::stock_k_plus, 0, 4, 3),
- 5, 2,
- "3C", "AH"
- );
-}
-
-TEST(KPlusStock, RedealExact) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = true;
- sr.stock_deal_count = 3;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2H","2D","3S","AD","2S","3C","AC","AH","AS"},
- {},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 4, 3, false, false),
- move(move::mtype::stock_k_plus, 0, 3, 9, false, true),
- },
- move(move::mtype::stock_k_plus, 0, 3, 9, false, true),
- 8, 0,
- "AS", card()
- );
-}
-
-TEST(KPlusStock, RedealOneExtra) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = true;
- sr.stock_deal_count = 3;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2H","AD","2S","3C","AC","AH","AS"},
- {},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 4, 3, false, false),
- move(move::mtype::stock_k_plus, 0, 3, 7, false, true),
- },
- move(move::mtype::stock_k_plus, 0, 3, 7, false, true),
- 6, 0,
- "AS", card()
- );
-}
-
-TEST(KPlusStock, RedealTwoExtra) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = true;
- sr.stock_deal_count = 3;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2S","2H","AD","2D","3C","AC","AH","AS"},
- {},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 4, 3, false, false)
- },
- move(move::mtype::stock_k_plus, 0, 4, 3, false, false),
- 5, 2,
- "3C", "AH"
- );
-}
-
-TEST(KPlusStock, RedealKPlus3Waste) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = true;
- sr.stock_deal_count = 3;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2H","2D","3S","AD","2S","3C"},
- {"AS","AH","AC"},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 3, 6, false, true),
- move(move::mtype::stock_k_plus, 0, 4, 0, false, false)
- },
- move(move::mtype::stock_k_plus, 0, 3, 6, false, true),
- 8, 0,
- "AS", card()
- );
-}
-
-TEST(KPlusStock, RedealKPlus4Waste) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = true;
- sr.stock_deal_count = 3;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2H","AD","3S","2D","2S"},
- {"AS","AH","AC","3C"},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 3, 5, false, true),
- move(move::mtype::stock_k_plus, 0, 4, -1, false, false),
- move(move::mtype::stock_k_plus, 0, 2, 2, false, false)
- },
- move(move::mtype::stock_k_plus, 0, 2, 2, false, false),
- 3, 5,
- "3S", "2S"
- );
-}
-
-TEST(KPlusStock, RedealKPlus5Waste) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 10;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = true;
- sr.stock_deal_count = 3;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2S","2D","2H","AD","2S"},
- {"AS","AH","AC","3C","4S"},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 3, 3, false, false),
- move(move::mtype::stock_k_plus, 0, 4, -2, false, false),
- move(move::mtype::stock_k_plus, 0, 2, 4, false, false)
- },
- move(move::mtype::stock_k_plus, 0, 3, 3, false, false),
- 2, 7,
- "2D", "AD"
- );
-}
-
-TEST(KPlusStock, RedealKPlusEmptyStock) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = true;
- sr.stock_deal_count = 3;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2H","2D","3S","AD","2S","3C"},
- {"AS","AH","AC"},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 3, 6, false, true),
- move(move::mtype::stock_k_plus, 0, 4, 0, false, false)
- },
- move(move::mtype::stock_k_plus, 0, 3, 6, false, true),
- 8, 0,
- "AS", card()
- );
-}
-
-TEST(KPlusStock, NoRedealCellFoundationMoves) {
- sol_rules sr;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = false;
- sr.stock_deal_count = 3;
- sr.cells = 2;
- sr.foundations_present = true;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"AC"}, {}, {}, {},
- {"2D"}, {},
- {"2H","AS","2C","AH","2S","3C"},
- {"3S"}
- },
- {
- // Cell moves
- move(move::mtype::stock_k_plus, 6, 5, 3),
- move(move::mtype::stock_k_plus, 6, 5, 6),
-
- // Foundation moves
- move(move::mtype::stock_k_plus, 6, 1, 3),
-
- // Regular waste move
- move(move::mtype::stock_k_plus, 6, 5, 0)
- },
- move(move::mtype::stock_k_plus, 6, 1, 3),
- 3, 3,
- "2C", "2S"
- );
-}
-
-TEST(KPlusStock, RedealCellFoundationMoves) {
- sol_rules sr;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = true;
- sr.stock_deal_count = 3;
- sr.cells = 2;
- sr.foundations_present = true;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"AC"}, {}, {}, {},
- {"2D"}, {},
- {"2H","AS","2C","AH","2S","3C"},
- {"3S"}
- },
- {
- // Cell moves
- move(move::mtype::stock_k_plus, 6, 5, 3, false, false),
- move(move::mtype::stock_k_plus, 6, 5, 6, false, true),
- move(move::mtype::stock_k_plus, 6, 5, 2, false, false),
- move(move::mtype::stock_k_plus, 6, 5, 5, false, false),
-
- // Foundation moves
- move(move::mtype::stock_k_plus, 6, 1, 3, false, false),
- move(move::mtype::stock_k_plus, 6, 2, 5, false, false),
-
- // Regular waste move
- move(move::mtype::stock_k_plus, 6, 5, 0)
- },
- move(move::mtype::stock_k_plus, 6, 2, 5, false, false),
- 1, 5,
- "2H", "2C"
- );
-}
-
-TEST(KPlusStock, RedealCount1BottomStock) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = true;
- sr.stock_deal_count = 1;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2H","2S","AD","2D"},
- {},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 2, 1, false, false),
- move(move::mtype::stock_k_plus, 0, 3, 4, false, true)
- },
- move(move::mtype::stock_k_plus, 0, 3, 4, false, true),
- 3, 0,
- "2D", card()
- );
-}
-
-TEST(KPlusStock, RedealCount1TopStock) {
- sol_rules sr;
- sr.tableau_pile_count = 3;
- sr.build_pol = pol::SAME_SUIT;
- sr.stock_size = 9;
- sr.stock_deal_t = sdt::WASTE;
- sr.stock_redeal = true;
- sr.stock_deal_count = 1;
-
- test_helper::k_plus_stock_test(
- sr,
- {
- {"2H","2S","AD","2D"},
- {},
- {"3D"},
- {"3H"},
- {"2C"}
- },
- {
- move(move::mtype::stock_k_plus, 0, 2, 1, false, false),
- move(move::mtype::stock_k_plus, 0, 3, 4, false, true)
- },
- move(move::mtype::stock_k_plus, 0, 2, 1, false, false),
- 3, 0,
- "AD", card()
- );
-}
diff --git a/src/test/unit_tests/legal_move_gen_test.cpp b/src/test/unit_tests/legal_move_gen_test.cpp
deleted file mode 100644
index da5c63c..0000000
--- a/src/test/unit_tests/legal_move_gen_test.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-//
-// Created by thecharlesblake on 1/11/18.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-#include "../../main/game/search-state/game_state.h"
-#include "../../main/game/sol_rules.h"
-#include "../../main/game/move.h"
-
-typedef sol_rules::build_policy pol;
-typedef sol_rules::spaces_policy s_pol;
-typedef sol_rules::stock_deal_type sdt;
-typedef sol_rules::built_group_type bgt;
-
-using std::vector;
-using std::ostream;
-
-typedef std::initializer_list<std::initializer_list<std::string>> string_il;
-
-
-TEST(LegalMoveGen, BuildPolAnySuit) {
- sol_rules sr;
- sr.build_pol = pol::ANY_SUIT;
- sr.tableau_pile_count = 5;
-
- game_state gs(sr, string_il{
- {"2C"},
- {"2H"},
- {"2D"},
- {"2S"},
- {"AC"}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- move(move::mtype::regular, 4,0),
- move(move::mtype::regular, 4,1),
- move(move::mtype::regular, 4,2),
- move(move::mtype::regular, 4,3)
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, BuildPolRedBlack) {
- sol_rules sr;
- sr.build_pol = pol::RED_BLACK;
- sr.tableau_pile_count = 5;
-
- game_state gs(sr, string_il{
- {"2C"},
- {"2H"},
- {"2S"},
- {"2D"},
- {"AC"}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- move(move::mtype::regular, 4,1),
- move(move::mtype::regular, 4,3)
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, BuildPolSameSuit) {
- sol_rules sr;
- sr.build_pol = pol::SAME_SUIT;
- sr.tableau_pile_count = 5;
-
- game_state gs(sr, string_il{
- {"2C"},
- {"2H"},
- {"2S"},
- {"2D"},
- {"AC"}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- move(move::mtype::regular, 4,0)
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, BuildPolNoBuild) {
- sol_rules sr;
- sr.build_pol = pol::NO_BUILD;
- sr.tableau_pile_count = 5;
-
- game_state gs(sr, string_il{
- {"2C"},
- {"2H"},
- {"2S"},
- {"2D"},
- {"AC"}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, SpacesPolAny) {
- sol_rules sr;
- sr.spaces_pol = s_pol::ANY;
- sr.tableau_pile_count = 2;
-
- game_state gs(sr, string_il{
- {},
- {"AC"}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- // move(move::mtype::regular, 1, 0) // Now forbidden as always pointless
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, SpacesPolKings) {
- sol_rules sr;
- sr.spaces_pol = s_pol::KINGS;
- sr.tableau_pile_count = 3;
-
- game_state gs(sr, string_il{
- {},
- {"AC"},
- {"3S","KD"}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- move(move::mtype::regular, 2, 0)
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, SpacesPolNoBuild) {
- sol_rules sr;
- sr.spaces_pol = s_pol::NO_BUILD;
- sr.tableau_pile_count = 2;
-
- game_state gs(sr, string_il{
- {},
- {"AC"}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, MoveBuiltGroupTrue) {
- sol_rules sr;
- sr.move_built_group = bgt::YES;
- sr.tableau_pile_count = 2;
-
- game_state gs(sr, string_il{
- {},
- {"2C", "AC"}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- move(move::mtype::regular, 1, 0, 1),
- move(move::mtype::built_group, 1, 0, 2)
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, MoveBuiltGroupFalse) {
- sol_rules sr;
- sr.move_built_group = bgt::NO;
- sr.tableau_pile_count = 2;
-
- game_state gs(sr, string_il{
- {},
- {"AC", "2C"}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- move(move::mtype::regular, 1, 0, 1)
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, Foundations) {
- sol_rules sr;
- sr.foundations_present = true;
- sr.tableau_pile_count = 4;
-
- game_state gs(sr, string_il{
- {}, {}, {}, {},
- {"AC"},
- {"AH"},
- {"AS"},
- {"AD"},
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- move(move::mtype::regular, 4, 0),
- move(move::mtype::regular, 5, 1),
- move(move::mtype::regular, 6, 2),
- move(move::mtype::regular, 7, 3)
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, FoundationsRemovable) {
- sol_rules sr;
- sr.foundations_present = true;
- sr.foundations_removable = true;
- sr.tableau_pile_count = 1;
-
- game_state gs(sr, string_il{
- {"AC","2C","3C"}, // Without a few cards here dominance logic blocks
- {}, // removing from foundation
- {},
- {},
- {}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- move(move::mtype::regular, 0, 4)
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-
-TEST(LegalMoveGen, TwoDecksFoundations) {
- sol_rules sr;
- sr.two_decks = true;
- sr.foundations_removable = true;
- sr.foundations_present = true;
- sr.tableau_pile_count = 4;
-
- game_state gs(sr, string_il{
- {"AC"}, {}, {}, {}, {}, {}, {"AS"}, {},
- {},
- {"AH"},
- {},
- {"AD"},
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- // Aces up
- move(move::mtype::regular, 9, 1),
- move(move::mtype::regular, 9, 5),
- move(move::mtype::regular, 11, 3),
- move(move::mtype::regular, 11, 7),
-
- // Aces down
- move(move::mtype::regular, 0, 8),
- move(move::mtype::regular, 0, 10),
- move(move::mtype::regular, 6, 8),
- move(move::mtype::regular, 6, 10),
-
- // Aces across (forbidden now)
- //move(move::mtype::regular, 9, 8),
- //move(move::mtype::regular, 9, 10),
- //move(move::mtype::regular, 11, 8),
- //move(move::mtype::regular, 11, 10),
-
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, Cells) {
- sol_rules sr;
- sr.cells = 2;
- sr.tableau_pile_count = 1;
-
- game_state gs(sr, string_il{
- {"3D"}, {}, // The cells
- {"4H"}
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- move(move::mtype::regular, 0, 2),
- move(move::mtype::regular, 2, 1)
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
-
-TEST(LegalMoveGen, StockDealToTableau) {
- sol_rules sr;
- sr.foundations_present = true;
- sr.tableau_pile_count = 3;
- sr.stock_size = 2;
- sr.stock_deal_t = sdt::TABLEAU_PILES;
-
- game_state gs(sr, string_il{
- {}, {}, {}, {}, // The foundations
- {"AC", "AD"}, // The stock
- {"3H"}, {"5D"}, {"7C"} // The tableau piles
- });
- vector<move> actual_moves = gs.get_legal_moves();
-
- vector<move> exp_moves = {
- move(move::mtype::stock_to_all_tableau, 0, 0, 2) // Special stock-to-tableau syntax
- };
-
- ASSERT_TRUE(test_helper::moves_eq(exp_moves, actual_moves)) << actual_moves;
-}
diff --git a/src/test/unit_tests/pile_test.cpp b/src/test/unit_tests/pile_test.cpp
deleted file mode 100644
index a5aeb66..0000000
--- a/src/test/unit_tests/pile_test.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// Created by thecharlesblake on 1/11/18.
-//
-
-#include <gtest/gtest.h>
-
-#include "../test_helper.h"
-#include "../../main/game/pile.h"
-
-TEST(Pile, Size) {
- pile p = {};
- ASSERT_EQ(0, p.size());
-
- p = {"AS"};
- ASSERT_EQ(1, p.size());
-
- p = {"AS", "KC", "4H"};
- ASSERT_EQ(3, p.size());
-}
-
-TEST(Pile, TopCard) {
- pile p = {"AS"};
- ASSERT_EQ(card("AS"), p.top_card());
-
- p = {"AS", "KC", "4H"};
- ASSERT_NE(card("AS"), p.top_card());
- ASSERT_EQ(card("4H"), p.top_card());
-}
-
-TEST(Pile, Index) {
- pile p = {"AS"};
- ASSERT_EQ(card("AS"), p[0]);
-
- p = {"AS", "KC", "4H"};
- ASSERT_EQ(card("AS"), p[2]);
- ASSERT_EQ(card("KC"), p[1]);
- ASSERT_EQ(card("4H"), p[0]);
-}
-
-TEST(Pile, Place) {
- pile t1 = {};
- pile t2 = {"AS"};
- pile t3 = {"AS", "KC", "4H"};
-
- pile p = {};
- ASSERT_EQ(p, t1);
-
- p.place("AS");
- ASSERT_NE(p, t1);
- ASSERT_EQ(p, t2);
-
- p.place("KC");
- p.place("4H");
- ASSERT_NE(p, t2);
- ASSERT_EQ(p, t3);
-}
-
-TEST(Pile, Take) {
- pile t1 = {};
- pile t2 = {"AS"};
- pile t3 = {"AS", "KC", "4H"};
-
- pile p = {"AS", "KC", "4H"};
- ASSERT_EQ(p, t3);
-
- p.take();
- p.take();
- ASSERT_NE(p, t3);
- ASSERT_EQ(p, t2);
-
- p.take();
- ASSERT_NE(p, t2);
- ASSERT_EQ(p, t1);
-}
-
-TEST(Pile, CompOperators) {
- pile p1 = {"3S"};
- pile p2 = {"AS", "AD", "AC"};
- pile p3 = {"2S", "2D", "2C"};
- pile p4 = {"AS", "AD", "AC", "AH"};
-
- ASSERT_LT(p1, p2);
- ASSERT_LT(p2, p3);
- ASSERT_LT(p3, p4);
- ASSERT_LT(p1, p4);
- ASSERT_EQ(p4, p4);
-}