From 6d1a7f2fbf08a6b9808ad977a83caa4504372e06 Mon Sep 17 00:00:00 2001 From: Charlie Blake Date: Tue, 10 Jul 2018 22:09:58 +0100 Subject: Add Gaps integration tests --- src/test/integration_tests/gaps_test.cpp | 28 ++++++++++++++++++++++++++ src/test/resources/gaps/ComplexSolvable.json | 7 +++++++ src/test/resources/gaps/ComplexUnsolvable.json | 7 +++++++ src/test/resources/gaps/SimpleSolvable.json | 7 +++++++ src/test/resources/gaps/SimpleUnsolvable.json | 7 +++++++ 5 files changed, 56 insertions(+) create mode 100644 src/test/integration_tests/gaps_test.cpp create mode 100644 src/test/resources/gaps/ComplexSolvable.json create mode 100644 src/test/resources/gaps/ComplexUnsolvable.json create mode 100644 src/test/resources/gaps/SimpleSolvable.json create mode 100644 src/test/resources/gaps/SimpleUnsolvable.json (limited to 'src/test') diff --git a/src/test/integration_tests/gaps_test.cpp b/src/test/integration_tests/gaps_test.cpp new file mode 100644 index 0000000..31f6d20 --- /dev/null +++ b/src/test/integration_tests/gaps_test.cpp @@ -0,0 +1,28 @@ +// +// Created by thecharlesblake on 10/4/17. +// + +#include + +#include "../test_helper.h" + +typedef test_helper th; + +const static std::string path = "resources/gaps/"; +const static std::string type = "simple-gaps"; + +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/resources/gaps/ComplexSolvable.json b/src/test/resources/gaps/ComplexSolvable.json new file mode 100644 index 0000000..92b3534 --- /dev/null +++ b/src/test/resources/gaps/ComplexSolvable.json @@ -0,0 +1,7 @@ +{ + "sequences": [ + ["4C","2S","2C",""], + ["2D","3S","4D",""], + ["4S","3C","3D",""] + ] +} \ No newline at end of file diff --git a/src/test/resources/gaps/ComplexUnsolvable.json b/src/test/resources/gaps/ComplexUnsolvable.json new file mode 100644 index 0000000..bea932a --- /dev/null +++ b/src/test/resources/gaps/ComplexUnsolvable.json @@ -0,0 +1,7 @@ +{ + "sequences": [ + ["2C","2S","4C",""], + ["3S","2D","4D",""], + ["4S","3C","3D",""] + ] +} diff --git a/src/test/resources/gaps/SimpleSolvable.json b/src/test/resources/gaps/SimpleSolvable.json new file mode 100644 index 0000000..5c3258a --- /dev/null +++ b/src/test/resources/gaps/SimpleSolvable.json @@ -0,0 +1,7 @@ +{ + "sequences": [ + ["2C","4S","4C",""], + ["2D","3S","4D",""], + ["2S","3C","3D",""] + ] +} \ No newline at end of file diff --git a/src/test/resources/gaps/SimpleUnsolvable.json b/src/test/resources/gaps/SimpleUnsolvable.json new file mode 100644 index 0000000..cb590e9 --- /dev/null +++ b/src/test/resources/gaps/SimpleUnsolvable.json @@ -0,0 +1,7 @@ +{ + "sequences": [ + ["4C","2S","2C",""], + ["4D","3S","2D",""], + ["4S","3C","3D",""] + ] +} \ No newline at end of file -- cgit v1.2.1 From 00e1416edd74ad6cb32123020aa3b2ca115afb52 Mon Sep 17 00:00:00 2001 From: Charlie Blake Date: Tue, 10 Jul 2018 23:03:10 +0100 Subject: Add deal parser json and fix bugs --- src/test/integration_tests/gaps_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/test') diff --git a/src/test/integration_tests/gaps_test.cpp b/src/test/integration_tests/gaps_test.cpp index 31f6d20..f7d0ebe 100644 --- a/src/test/integration_tests/gaps_test.cpp +++ b/src/test/integration_tests/gaps_test.cpp @@ -11,18 +11,18 @@ typedef test_helper th; const static std::string path = "resources/gaps/"; const static std::string type = "simple-gaps"; -TEST(AlphaStar, SimpleSolvable) { +TEST(Gaps, SimpleSolvable) { EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type)); } -TEST(AlphaStar, ComplexSolvable) { +TEST(Gaps, ComplexSolvable) { EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type)); } -TEST(AlphaStar, SimpleUnsolvable) { +TEST(Gaps, SimpleUnsolvable) { EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type)); } -TEST(AlphaStar, ComplexUnsolvable) { +TEST(Gaps, ComplexUnsolvable) { EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type)); } -- cgit v1.2.1 From f845a2eed1eb5a10977cba36e3c448397a455c68 Mon Sep 17 00:00:00 2001 From: Charlie Blake Date: Thu, 12 Jul 2018 00:04:09 +0100 Subject: Gaps / sequence implementation --- src/test/resources/gaps/ComplexSolvable.json | 3 ++- src/test/resources/gaps/ComplexUnsolvable.json | 5 +++-- src/test/resources/gaps/SimpleSolvable.json | 3 ++- src/test/resources/gaps/SimpleUnsolvable.json | 9 +++++---- 4 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/test') diff --git a/src/test/resources/gaps/ComplexSolvable.json b/src/test/resources/gaps/ComplexSolvable.json index 92b3534..f9fcb41 100644 --- a/src/test/resources/gaps/ComplexSolvable.json +++ b/src/test/resources/gaps/ComplexSolvable.json @@ -2,6 +2,7 @@ "sequences": [ ["4C","2S","2C",""], ["2D","3S","4D",""], - ["4S","3C","3D",""] + ["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 index bea932a..2c9de3e 100644 --- a/src/test/resources/gaps/ComplexUnsolvable.json +++ b/src/test/resources/gaps/ComplexUnsolvable.json @@ -1,7 +1,8 @@ { "sequences": [ - ["2C","2S","4C",""], + ["2C","4S","4C",""], ["3S","2D","4D",""], - ["4S","3C","3D",""] + ["2S","3C","3D",""], + ["2H","3H","4H",""] ] } diff --git a/src/test/resources/gaps/SimpleSolvable.json b/src/test/resources/gaps/SimpleSolvable.json index 5c3258a..2e9cdfe 100644 --- a/src/test/resources/gaps/SimpleSolvable.json +++ b/src/test/resources/gaps/SimpleSolvable.json @@ -2,6 +2,7 @@ "sequences": [ ["2C","4S","4C",""], ["2D","3S","4D",""], - ["2S","3C","3D",""] + ["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 index cb590e9..b0c0529 100644 --- a/src/test/resources/gaps/SimpleUnsolvable.json +++ b/src/test/resources/gaps/SimpleUnsolvable.json @@ -1,7 +1,8 @@ { "sequences": [ - ["4C","2S","2C",""], - ["4D","3S","2D",""], - ["4S","3C","3D",""] + ["2C","3C","4C",""], + ["3S","2D","4D",""], + ["2S","4S","3D",""], + ["2H","3H","4H",""] ] -} \ No newline at end of file +} -- cgit v1.2.1