diff options
| author | Leonetienne <leonetienne@hotmail.de> | 2022-02-12 16:04:48 +0100 |
|---|---|---|
| committer | Leonetienne <leonetienne@hotmail.de> | 2022-02-12 16:04:48 +0100 |
| commit | 7726d64530f82fc9b8ac08f484491335bd7ca2a4 (patch) | |
| tree | 903e6f16b10f64a420c86ae93eaa8315a313ae2b /Test/Upper.cpp | |
| parent | a8b8d557692823931bb41dcd55627080f55b6099 (diff) | |
Optimized directory structure
Diffstat (limited to 'Test/Upper.cpp')
| -rw-r--r-- | Test/Upper.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/Test/Upper.cpp b/Test/Upper.cpp new file mode 100644 index 0000000..8d34fa2 --- /dev/null +++ b/Test/Upper.cpp @@ -0,0 +1,72 @@ +#include <StringTools.h>
+#include "Catch2.h"
+
+// Tests that uppering an empty string returns an empty string
+TEST_CASE(__FILE__"/EmptyString", "[Upper]")
+{
+ // Setup
+ const std::string in = "";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ REQUIRE(out == "");
+ return;
+}
+
+// Tests that uppering a string without any letters returns itself
+TEST_CASE(__FILE__"/Symbols", "[Upper]")
+{
+ // Setup
+ const std::string in = "66! _-\n*";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ REQUIRE(out == "66! _-\n*");
+ return;
+}
+
+// Tests that uppering a string of uppercase letters returns itself
+TEST_CASE(__FILE__"/AlreadyUppered", "[Upper]")
+{
+ // Setup
+ const std::string in = "UGHAREYOUSERIOUS";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ REQUIRE(out == "UGHAREYOUSERIOUS");
+ return;
+}
+
+// Tests that uppering a string of lowercase letters returns the uppercase version
+TEST_CASE(__FILE__"/Lowercase", "[Upper]")
+{
+ // Setup
+ const std::string in = "ughareyouserious";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ REQUIRE(out == "UGHAREYOUSERIOUS");
+ return;
+}
+
+// Tests that uppering a string of uppercase, lowercase letters and symbols returns the uppercase version
+TEST_CASE(__FILE__"/Mixed", "[Upper]")
+{
+ // Setup
+ const std::string in = "Ugh, Are You Serious?! DON'T do that!!!";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ REQUIRE(out == "UGH, ARE YOU SERIOUS?! DON'T DO THAT!!!");
+ return;
+}
|
