summaryrefslogtreecommitdiffstats
path: root/Test/String__Lower.cpp
diff options
context:
space:
mode:
authorLeonetienne <leonetienne@hotmail.de>2022-02-12 20:07:48 +0100
committerLeonetienne <leonetienne@hotmail.de>2022-02-12 20:07:48 +0100
commitab1a3672c3392cb2eaf21d020fd09e698e96e255 (patch)
tree51a91ee90a81d58028647adaffc597ffdbca2310 /Test/String__Lower.cpp
parentcf397f3af828bf1f87392a5a1c349284589d25af (diff)
Added tests for char tools
Diffstat (limited to 'Test/String__Lower.cpp')
-rw-r--r--Test/String__Lower.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/Test/String__Lower.cpp b/Test/String__Lower.cpp
new file mode 100644
index 0000000..c198394
--- /dev/null
+++ b/Test/String__Lower.cpp
@@ -0,0 +1,72 @@
+#include <StringTools.h>
+#include "Catch2.h"
+
+// Tests that lowering an empty string returns an empty string
+TEST_CASE(__FILE__"/EmptyString", "[Strings][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", "[Strings][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", "[Strings][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", "[Strings][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", "[Strings][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;
+}