aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorCharlie Blake2018-01-09 08:58:30 +0000
committerGitHub2018-01-09 08:58:30 +0000
commit93bfbeec309b027331f75d10864c99f19a958cfd (patch)
tree5ad08a4621dbc118480553d53666e3e507ce584e /src/test
parentMerge pull request #27 from thecharlesblake/efficient-implementation (diff)
parentAdd spider to benchmark script (diff)
downloadmetasol-93bfbeec309b027331f75d10864c99f19a958cfd.tar.gz
metasol-93bfbeec309b027331f75d10864c99f19a958cfd.zip

Merge pull request #28 from thecharlesblake/all-canonical-games

All canonical games

Diffstat (limited to 'src/test')
-rw-r--r--src/test/alpha_star_test.cpp28
-rw-r--r--src/test/bakers_dozen_test.cpp28
-rw-r--r--src/test/canfield_test.cpp28
-rw-r--r--src/test/flower_garden_test.cpp28
-rw-r--r--src/test/fortunes_favor_test.cpp28
-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.json4
-rw-r--r--src/test/resources/canfield/ComplexSolvable.json9
-rw-r--r--src/test/resources/canfield/ComplexUnsolvable.json9
-rw-r--r--src/test/resources/canfield/SimpleSolvable.json9
-rw-r--r--src/test/resources/canfield/SimpleUnsolvable.json9
-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/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/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/somerset_test.cpp28
-rw-r--r--src/test/spider_test.cpp28
-rw-r--r--src/test/test_helper.cpp9
37 files changed, 444 insertions, 6 deletions
diff --git a/src/test/alpha_star_test.cpp b/src/test/alpha_star_test.cpp
new file mode 100644
index 0000000..eeff1be
--- /dev/null
+++ b/src/test/alpha_star_test.cpp
@@ -0,0 +1,28 @@
+//
+// 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/bakers_dozen_test.cpp b/src/test/bakers_dozen_test.cpp
new file mode 100644
index 0000000..0af0669
--- /dev/null
+++ b/src/test/bakers_dozen_test.cpp
@@ -0,0 +1,28 @@
+//
+// 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/canfield_test.cpp b/src/test/canfield_test.cpp
new file mode 100644
index 0000000..63fd615
--- /dev/null
+++ b/src/test/canfield_test.cpp
@@ -0,0 +1,28 @@
+//
+// 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/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));
+}
diff --git a/src/test/flower_garden_test.cpp b/src/test/flower_garden_test.cpp
new file mode 100644
index 0000000..b1aee9e
--- /dev/null
+++ b/src/test/flower_garden_test.cpp
@@ -0,0 +1,28 @@
+//
+// 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/fortunes_favor_test.cpp b/src/test/fortunes_favor_test.cpp
new file mode 100644
index 0000000..eab2e7e
--- /dev/null
+++ b/src/test/fortunes_favor_test.cpp
@@ -0,0 +1,28 @@
+//
+// 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/resources/alpha_star/ComplexSolvable.json b/src/test/resources/alpha_star/ComplexSolvable.json
new file mode 100644
index 0000000..e7eedd5
--- /dev/null
+++ b/src/test/resources/alpha_star/ComplexSolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["3S","2C","3C","5C","5H","4H"],
+ ["4S","4C","5S","2D","5D"],
+ ["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
new file mode 100644
index 0000000..a01f2b5
--- /dev/null
+++ b/src/test/resources/alpha_star/ComplexUnsolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["2S","2C","3C","5C","5H","4H"],
+ ["4S","4C","5S","2D","5D"],
+ ["3S","2H","3H","4D","3D"]
+ ]
+}
diff --git a/src/test/resources/alpha_star/SimpleSolvable.json b/src/test/resources/alpha_star/SimpleSolvable.json
new file mode 100644
index 0000000..d160e42
--- /dev/null
+++ b/src/test/resources/alpha_star/SimpleSolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["5S","5C","4C","3C","2S","2C"],
+ ["5D","4D","3S","3D","2D"],
+ ["5H","4S","4H","3H","2H"]
+ ]
+}
diff --git a/src/test/resources/alpha_star/SimpleUnsolvable.json b/src/test/resources/alpha_star/SimpleUnsolvable.json
new file mode 100644
index 0000000..1097473
--- /dev/null
+++ b/src/test/resources/alpha_star/SimpleUnsolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["2S","2C","3C","4C","5S","5C"],
+ ["2D","3D","4S","4D","5D"],
+ ["2H","3S","3H","4H","5H"]
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/bakers_dozen/ComplexSolvable.json b/src/test/resources/bakers_dozen/ComplexSolvable.json
new file mode 100644
index 0000000..b953413
--- /dev/null
+++ b/src/test/resources/bakers_dozen/ComplexSolvable.json
@@ -0,0 +1,7 @@
+{
+ "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
new file mode 100644
index 0000000..a8247c4
--- /dev/null
+++ b/src/test/resources/bakers_dozen/ComplexUnsolvable.json
@@ -0,0 +1,7 @@
+{
+ "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
new file mode 100644
index 0000000..7c00a71
--- /dev/null
+++ b/src/test/resources/bakers_dozen/SimpleSolvable.json
@@ -0,0 +1,7 @@
+{
+ "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
new file mode 100644
index 0000000..0b39a8d
--- /dev/null
+++ b/src/test/resources/bakers_dozen/SimpleUnsolvable.json
@@ -0,0 +1,7 @@
+{
+ "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
index 8d0249d..15488e9 100644
--- a/src/test/resources/black_hole/ComplexSolvable.json
+++ b/src/test/resources/black_hole/ComplexSolvable.json
@@ -1,8 +1,8 @@
{
"tableau piles": [
["5D","4D","3D","2D","AD"],
- ["5C","4C","3C","2C","4H","5H"],
- ["AC","AH","2H","3H"],
+ ["5C","4C","3C","2C","4H"],
+ ["AC","AH","2H","3H","5H"],
["2S","5S","4S","3S"]
],
"hole": "AS"
diff --git a/src/test/resources/canfield/ComplexSolvable.json b/src/test/resources/canfield/ComplexSolvable.json
new file mode 100644
index 0000000..b5c9253
--- /dev/null
+++ b/src/test/resources/canfield/ComplexSolvable.json
@@ -0,0 +1,9 @@
+{
+ "tableau piles": [
+ ["AC","2C","3C"],
+ ["AD","2D","3D"],
+ ["3S","AS","3H"]
+ ],
+ "stock": ["2H"],
+ "reserve": ["AH","2S"]
+} \ No newline at end of file
diff --git a/src/test/resources/canfield/ComplexUnsolvable.json b/src/test/resources/canfield/ComplexUnsolvable.json
new file mode 100644
index 0000000..9391caf
--- /dev/null
+++ b/src/test/resources/canfield/ComplexUnsolvable.json
@@ -0,0 +1,9 @@
+{
+ "tableau piles": [
+ ["AC","2H","2D"],
+ ["AD","3D","3C"],
+ ["2S","AS","3H"]
+ ],
+ "stock": ["2C"],
+ "reserve": ["AH","3S"]
+} \ No newline at end of file
diff --git a/src/test/resources/canfield/SimpleSolvable.json b/src/test/resources/canfield/SimpleSolvable.json
new file mode 100644
index 0000000..4e998ea
--- /dev/null
+++ b/src/test/resources/canfield/SimpleSolvable.json
@@ -0,0 +1,9 @@
+{
+ "tableau piles": [
+ ["3C","2C","AC"],
+ ["3D","2D","AD"],
+ ["3H","3S","AH"]
+ ],
+ "stock": ["2H"],
+ "reserve": ["2S","AS"]
+}
diff --git a/src/test/resources/canfield/SimpleUnsolvable.json b/src/test/resources/canfield/SimpleUnsolvable.json
new file mode 100644
index 0000000..e8a1e3e
--- /dev/null
+++ b/src/test/resources/canfield/SimpleUnsolvable.json
@@ -0,0 +1,9 @@
+{
+ "tableau piles": [
+ ["AC","2C","3C"],
+ ["AD","2D","3D"],
+ ["AH","AS","3H"]
+ ],
+ "stock": ["2H"],
+ "reserve": ["2S","3S"]
+} \ No newline at end of file
diff --git a/src/test/resources/flower_garden/ComplexSolvable.json b/src/test/resources/flower_garden/ComplexSolvable.json
new file mode 100644
index 0000000..1f1a6e6
--- /dev/null
+++ b/src/test/resources/flower_garden/ComplexSolvable.json
@@ -0,0 +1,8 @@
+{
+ "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
new file mode 100644
index 0000000..be0ca64
--- /dev/null
+++ b/src/test/resources/flower_garden/ComplexUnsolvable.json
@@ -0,0 +1,8 @@
+{
+ "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
new file mode 100644
index 0000000..18c680d
--- /dev/null
+++ b/src/test/resources/flower_garden/SimpleSolvable.json
@@ -0,0 +1,8 @@
+{
+ "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
new file mode 100644
index 0000000..e57e9ca
--- /dev/null
+++ b/src/test/resources/flower_garden/SimpleUnsolvable.json
@@ -0,0 +1,8 @@
+{
+ "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
new file mode 100644
index 0000000..f00d600
--- /dev/null
+++ b/src/test/resources/fortunes_favor/ComplexSolvable.json
@@ -0,0 +1,8 @@
+{
+ "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
new file mode 100644
index 0000000..4f54b94
--- /dev/null
+++ b/src/test/resources/fortunes_favor/ComplexUnsolvable.json
@@ -0,0 +1,8 @@
+{
+ "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
new file mode 100644
index 0000000..0891746
--- /dev/null
+++ b/src/test/resources/fortunes_favor/SimpleSolvable.json
@@ -0,0 +1,8 @@
+{
+ "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
new file mode 100644
index 0000000..44d7359
--- /dev/null
+++ b/src/test/resources/fortunes_favor/SimpleUnsolvable.json
@@ -0,0 +1,8 @@
+{
+ "tableau piles": [
+ ["2C","2D","3C"],
+ ["2H","3D","3H"],
+ ["2S","4D","4H"]
+ ],
+ "stock": ["4C","3S","4S"]
+}
diff --git a/src/test/resources/somerset/ComplexSolvable.json b/src/test/resources/somerset/ComplexSolvable.json
new file mode 100644
index 0000000..b316c50
--- /dev/null
+++ b/src/test/resources/somerset/ComplexSolvable.json
@@ -0,0 +1,8 @@
+{
+ "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
new file mode 100644
index 0000000..09d7864
--- /dev/null
+++ b/src/test/resources/somerset/ComplexUnsolvable.json
@@ -0,0 +1,8 @@
+{
+ "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
new file mode 100644
index 0000000..b316c50
--- /dev/null
+++ b/src/test/resources/somerset/SimpleSolvable.json
@@ -0,0 +1,8 @@
+{
+ "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
new file mode 100644
index 0000000..09d7864
--- /dev/null
+++ b/src/test/resources/somerset/SimpleUnsolvable.json
@@ -0,0 +1,8 @@
+{
+ "tableau piles": [
+ ["AS","AC","2C"],
+ ["AD","2D"],
+ ["AH","2H"],
+ ["2S"]
+ ]
+}
diff --git a/src/test/resources/spider/ComplexSolvable.json b/src/test/resources/spider/ComplexSolvable.json
new file mode 100644
index 0000000..3591805
--- /dev/null
+++ b/src/test/resources/spider/ComplexSolvable.json
@@ -0,0 +1,13 @@
+{
+ "tableau piles": [
+ ["2D","AD","3D"],
+ ["AC","2C","3C"],
+ ["AS","2S","3S"],
+ ["AH","2H","3H"]
+ ],
+ "stock": [
+ "2C","2D","2H","2S",
+ "AC","AD","AH","AS",
+ "3C","3D","3H","3S"
+ ]
+}
diff --git a/src/test/resources/spider/ComplexUnsolvable.json b/src/test/resources/spider/ComplexUnsolvable.json
new file mode 100644
index 0000000..8fce03d
--- /dev/null
+++ b/src/test/resources/spider/ComplexUnsolvable.json
@@ -0,0 +1,13 @@
+{
+ "tableau piles": [
+ ["2D","AD","3D"],
+ ["AC","AC","3C"],
+ ["AS","AS","3S"],
+ ["AH","AH","3H"]
+ ],
+ "stock": [
+ "2C","2D","2H","2S",
+ "AC","2D","2H","2S",
+ "3C","3D","3H","3S"
+ ]
+}
diff --git a/src/test/resources/spider/SimpleSolvable.json b/src/test/resources/spider/SimpleSolvable.json
new file mode 100644
index 0000000..f0b9b00
--- /dev/null
+++ b/src/test/resources/spider/SimpleSolvable.json
@@ -0,0 +1,14 @@
+{
+ "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
new file mode 100644
index 0000000..d11a6dd
--- /dev/null
+++ b/src/test/resources/spider/SimpleUnsolvable.json
@@ -0,0 +1,13 @@
+{
+ "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/somerset_test.cpp b/src/test/somerset_test.cpp
new file mode 100644
index 0000000..22cfe5a
--- /dev/null
+++ b/src/test/somerset_test.cpp
@@ -0,0 +1,28 @@
+//
+// 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/spider_test.cpp b/src/test/spider_test.cpp
new file mode 100644
index 0000000..0e21f86
--- /dev/null
+++ b/src/test/spider_test.cpp
@@ -0,0 +1,28 @@
+//
+// 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));
+}
+
+TEST(Spider, ComplexUnsolvable) {
+ EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
+}
diff --git a/src/test/test_helper.cpp b/src/test/test_helper.cpp
index 9c258a3..14218f7 100644
--- a/src/test/test_helper.cpp
+++ b/src/test/test_helper.cpp
@@ -7,17 +7,18 @@
#include "test_helper.h"
#include "../main/game/game_state.h"
#include "../main/solver/solver.h"
-#include "../main/util/util.h"
+#include "../main/input-output/input/json-parsing/json_helper.h"
+#include "../main/input-output/input/json-parsing/rules_parser.h"
using namespace rapidjson;
using namespace std;
bool test_helper::is_solvable(const std::string& input_file, const std::string& preset_type) {
- const Document in_doc = util::get_file_json(input_file);
- const sol_rules rules = sol_rules::from_preset(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);
solver sol(gs, rules);
- return sol.run() ? true : false;
+ return sol.run();
}