From 98c83ae9721d0018988518b531c4dd18af715483 Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Sat, 4 Dec 2021 20:36:24 +0100 Subject: added umlaut support for Lower/Upper for îíì MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StringTools/Test/Lower.cpp | 30 ++++++++++++++++++++++++++++-- StringTools/Test/Upper.cpp | 30 ++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 4 deletions(-) (limited to 'StringTools/Test') diff --git a/StringTools/Test/Lower.cpp b/StringTools/Test/Lower.cpp index c45af68..941cdb3 100644 --- a/StringTools/Test/Lower.cpp +++ b/StringTools/Test/Lower.cpp @@ -183,17 +183,43 @@ namespace _StringTools Assert::AreEqual("öóòô", out.c_str()); } + // Tests that lowering already lowered umlautes returns itself + TEST_METHOD(Umlautes_already_lower_i) + { + // 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_i) + { + // Setup + const std::string in = "ÍÌÎ"; + + // Exercise + const std::string out = StringTools::Lower(in); + + // Verify + Assert::AreEqual("íìî", out.c_str()); + } + // 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óü Seriöûs?! DÓN'T DÒ THÄT!!!"; + const std::string in = "Ügh, Àrä Yóü Serîöûs?! DÓN'T DÒ THÄT!!!"; // Exercise const std::string out = StringTools::Lower(in); // Verify - Assert::AreEqual("ügh, àrä yóü seriöûs?! dón't dò thät!!!", out.c_str()); + Assert::AreEqual("ügh, àrä yóü serîöûs?! dón't dò thät!!!", out.c_str()); return; } }; diff --git a/StringTools/Test/Upper.cpp b/StringTools/Test/Upper.cpp index cbefee7..1e7684b 100644 --- a/StringTools/Test/Upper.cpp +++ b/StringTools/Test/Upper.cpp @@ -183,17 +183,43 @@ namespace _StringTools Assert::AreEqual("ÖÓÒÔ", out.c_str()); } + // Tests that lowering already lowered umlautes returns itself + TEST_METHOD(Umlautes_already_upper_i) + { + // Setup + const std::string in = "ÍÌÎ"; + + // Exercise + const std::string out = StringTools::Upper(in); + + // Verify + Assert::AreEqual("ÍÌÎ", out.c_str()); + } + + // Tests that lowering uppercase umlautes returns the lowered umlautes + TEST_METHOD(Umlautes_upper_i) + { + // Setup + const std::string in = "íìî"; + + // Exercise + const std::string out = StringTools::Upper(in); + + // Verify + Assert::AreEqual("ÍÌÎ", out.c_str()); + } + // Tests that uppering 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óü Seriöûs?! DÒN'T DÔ THÄT!!!"; + const std::string in = "Ügh, Àrä Yóü Serîöûs?! DÒN'T DÔ THÄT!!!"; // Exercise const std::string out = StringTools::Upper(in); // Verify - Assert::AreEqual("ÜGH, ÀRÄ YÓÜ SERIÖÛS?! DÒN'T DÔ THÄT!!!", out.c_str()); + Assert::AreEqual("ÜGH, ÀRÄ YÓÜ SERÎÖÛS?! DÒN'T DÔ THÄT!!!", out.c_str()); return; } }; -- cgit v1.2.3