summaryrefslogtreecommitdiff
path: root/2015-spacebot/test/move_string_mapper.cpp
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2022-04-19 21:28:44 +0200
committerJustin Wernick <justin@worthe-it.co.za>2022-04-19 21:28:44 +0200
commitdc01a3e25e6c4ef056467e36f876ebd68f3ade22 (patch)
tree2147462c4cbe9a7b0de59d13bb20c842e33f75a3 /2015-spacebot/test/move_string_mapper.cpp
parentbe89211af895548425be999f660a1195efe9fc8a (diff)
parent8eebf1079fbed2848ee47cf990f5def5926a0c1f (diff)
Merge branch 'spacebot-main'
Diffstat (limited to '2015-spacebot/test/move_string_mapper.cpp')
-rw-r--r--2015-spacebot/test/move_string_mapper.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/2015-spacebot/test/move_string_mapper.cpp b/2015-spacebot/test/move_string_mapper.cpp
new file mode 100644
index 0000000..a7af36a
--- /dev/null
+++ b/2015-spacebot/test/move_string_mapper.cpp
@@ -0,0 +1,38 @@
+#include "catch.hpp"
+#include "move.h"
+#include <string>
+#include "move_string_mapper.h"
+
+SCENARIO("Writing a move")
+{
+ GIVEN("A Move")
+ {
+ Move move = Move::MOVE_LEFT;
+
+ WHEN("It is mapped to a string")
+ {
+ std::string moveString = MoveStringMapper().toString(move);
+
+ THEN("The string is correct")
+ {
+ REQUIRE(moveString == "MoveLeft");
+ }
+ }
+
+ }
+
+ GIVEN("Build missle controller move")
+ {
+ Move move = Move::BUILD_MISSILE_CONTROLLER;
+
+ WHEN("It is mapped to a string")
+ {
+ std::string moveString = MoveStringMapper().toString(move);
+
+ THEN("The string is correct")
+ {
+ REQUIRE(moveString == "BuildMissileController");
+ }
+ }
+ }
+}