summaryrefslogtreecommitdiffstats
path: root/Src/Test/Lower.cpp
diff options
context:
space:
mode:
authorLeonetienne <leonetienne@hotmail.de>2022-02-12 03:07:11 +0100
committerLeonetienne <leonetienne@hotmail.de>2022-02-12 03:07:11 +0100
commita6c9e64eb559a58d31f5ea68b8947f460ed8f04b (patch)
tree0e5789541a3d26e4c0c1bed8a0585be27fc182ec /Src/Test/Lower.cpp
parentf4e36ec9af5002eaa51c742faa10e4cbc7d66de0 (diff)
Better directory structure naming
Diffstat (limited to 'Src/Test/Lower.cpp')
-rw-r--r--Src/Test/Lower.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/Src/Test/Lower.cpp b/Src/Test/Lower.cpp
new file mode 100644
index 0000000..4c8abef
--- /dev/null
+++ b/Src/Test/Lower.cpp
@@ -0,0 +1,72 @@
+#include <StringTools/StringTools.h>
+#include "Catch2.h"
+
+// Tests that lowering an empty string returns an empty string
+TEST_CASE(__FILE__"/EmptyString", "[Lower]")
+{
+ // Setup
+ const std::string in = "";
+
+ // Exercise
+ const std::string out = StringTools::Lower(in);
+
+ // Verify
+ REQUIRE(out == "");
+ return;
+}
+
+// Tests that lowering a string without any letters returns itself
+TEST_CASE(__FILE__"/Symbols", "[Lower]")
+{
+ // Setup
+ const std::string in = "66! _-\n*";
+
+ // Exercise
+ const std::string out = StringTools::Lower(in);
+
+ // Verify
+ REQUIRE(out == "66! _-\n*");
+ return;
+}
+
+// Tests that lowering a string of lowercase letters returns itself
+TEST_CASE(__FILE__"/AlreadyLowered", "[Lower]")
+{
+ // Setup
+ const std::string in = "ughareyouserious";
+
+ // Exercise
+ const std::string out = StringTools::Lower(in);
+
+ // Verify
+ REQUIRE(out == "ughareyouserious");
+ return;
+}
+
+// Tests that lowering a string of uppercase letters returns the lowercase version
+TEST_CASE(__FILE__"/Uppercase", "[Lower]")
+{
+ // Setup
+ const std::string in = "UGHAREYOUSERIOUS";
+
+ // Exercise
+ const std::string out = StringTools::Lower(in);
+
+ // Verify
+ REQUIRE(out == "ughareyouserious");
+ return;
+}
+
+// Tests that lowering a string of uppercase, lowercase letters and symbols returns the lowercase version
+TEST_CASE(__FILE__"/Mixed", "[Lower]")
+{
+ // Setup
+ const std::string in = "Ugh, Are You Serious?! DON'T DO THAT!!!";
+
+ // Exercise
+ const std::string out = StringTools::Lower(in);
+
+ // Verify
+ REQUIRE(out == "ugh, are you serious?! don't do that!!!");
+ return;
+}