diff options
Diffstat (limited to 'StringTools/Test/Lower.cpp')
| -rw-r--r-- | StringTools/Test/Lower.cpp | 264 |
1 files changed, 55 insertions, 209 deletions
diff --git a/StringTools/Test/Lower.cpp b/StringTools/Test/Lower.cpp index 941cdb3..a848184 100644 --- a/StringTools/Test/Lower.cpp +++ b/StringTools/Test/Lower.cpp @@ -1,226 +1,72 @@ -#include "CppUnitTest.h"
-#include "../StringTools/StringTools.h"
+#include <StringTools/StringTools.h>
+#include "Catch2.h"
-using namespace Microsoft::VisualStudio::CppUnitTestFramework;
-
-namespace _StringTools
+// Tests that lowering an empty string returns an empty string
+TEST_CASE(__FILE__"/EmptyString", "[LOWER]")
{
- TEST_CLASS(_Lower)
- {
- public:
-
- // Tests that lowering an empty string returns an empty string
- TEST_METHOD(EmptyString)
- {
- // Setup
- const std::string in = "";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("", out.c_str());
- return;
- }
-
- // Tests that lowering a string without any letters returns an itself
- TEST_METHOD(Symbols)
- {
- // Setup
- const std::string in = "66! _-\n*";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("66! _-\n*", out.c_str());
- return;
- }
-
- // Tests that lowering a string of lowercase letters returns itself
- TEST_METHOD(AlreadyLowered)
- {
- // Setup
- const std::string in = "ughareyouserious";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("ughareyouserious", out.c_str());
- return;
- }
-
- // Tests that lowering a string of uppercase letters returns the lowercase version
- TEST_METHOD(Uppercase)
- {
- // Setup
- const std::string in = "UGHAREYOUSERIOUS";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("ughareyouserious", out.c_str());
- return;
- }
-
- // Tests that lowering a string of uppercase, lowercase letters and symbols returns the lowercase version
- TEST_METHOD(Mixed)
- {
- // Setup
- const std::string in = "Ugh, Are You Serious?! DON'T DO THAT!!!";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("ugh, are you serious?! don't do that!!!", out.c_str());
- return;
- }
-
- // Tests that lowering already lowered umlautes returns itself
- TEST_METHOD(Umlautes_already_lower_a)
- {
- // Setup
- const std::string in = "äáàâ";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("äáàâ", out.c_str());
- }
-
- // Tests that lowering uppercase umlautes returns the lowered umlautes
- TEST_METHOD(Umlautes_upper_a)
- {
- // Setup
- const std::string in = "ÄÁÀÂ";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("äáàâ", out.c_str());
- }
+ // Setup
+ const std::string in = "";
- // Tests that lowering already lowered umlautes returns itself
- TEST_METHOD(Umlautes_already_lower_e)
- {
- // Setup
- const std::string in = "éèê";
+ // Exercise
+ const std::string out = StringTools::Lower(in);
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("éèê", out.c_str());
- }
-
- // Tests that lowering uppercase umlautes returns the lowered umlautes
- TEST_METHOD(Umlautes_upper_e)
- {
- // Setup
- const std::string in = "ÉÈÊ";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("éèê", out.c_str());
- }
-
- // Tests that lowering already lowered umlautes returns itself
- TEST_METHOD(Umlautes_already_lower_u)
- {
- // Setup
- const std::string in = "üúùû";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("üúùû", out.c_str());
- }
-
- // Tests that lowering uppercase umlautes returns the lowered umlautes
- TEST_METHOD(Umlautes_upper_u)
- {
- // Setup
- const std::string in = "ÜÚÙÛ";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("üúùû", out.c_str());
- }
-
- // Tests that lowering already lowered umlautes returns itself
- TEST_METHOD(Umlautes_already_lower_o)
- {
- // Setup
- const std::string in = "öóòô";
-
- // Exercise
- const std::string out = StringTools::Lower(in);
-
- // Verify
- Assert::AreEqual("öóòô", out.c_str());
- }
+ // Verify
+ REQUIRE(out == "");
+ return;
+}
- // Tests that lowering uppercase umlautes returns the lowered umlautes
- TEST_METHOD(Umlautes_upper_o)
- {
- // Setup
- const std::string in = "ÖÓÒÔ";
+// 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);
+ // Exercise
+ const std::string out = StringTools::Lower(in);
- // Verify
- Assert::AreEqual("öóòô", out.c_str());
- }
+ // Verify
+ REQUIRE(out == "66! _-\n*");
+ return;
+}
- // Tests that lowering already lowered umlautes returns itself
- TEST_METHOD(Umlautes_already_lower_i)
- {
- // Setup
- const std::string in = "íìî";
+// 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);
+ // Exercise
+ const std::string out = StringTools::Lower(in);
- // Verify
- Assert::AreEqual("íìî", out.c_str());
- }
+ // Verify
+ REQUIRE(out == "ughareyouserious");
+ return;
+}
- // Tests that lowering uppercase umlautes returns the lowered umlautes
- TEST_METHOD(Umlautes_upper_i)
- {
- // Setup
- const std::string in = "ÍÌÎ";
+// 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);
+ // Exercise
+ const std::string out = StringTools::Lower(in);
- // Verify
- Assert::AreEqual("íìî", out.c_str());
- }
+ // Verify
+ REQUIRE(out == "ughareyouserious");
+ return;
+}
- // Tests that lowering a string of uppercase, lowercase letters and symbols returns the lowercase version, even with umlauts
- TEST_METHOD(Mixed_with_umlautes)
- {
- // Setup
- const std::string in = "Ügh, Àrä Yóü Serîöûs?! DÓN'T DÒ THÄT!!!";
+// 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);
+ // Exercise
+ const std::string out = StringTools::Lower(in);
- // Verify
- Assert::AreEqual("ügh, àrä yóü serîöûs?! dón't dò thät!!!", out.c_str());
- return;
- }
- };
+ // Verify
+ REQUIRE(out == "ugh, are you serious?! don't do that!!!");
+ return;
}
|
