summaryrefslogtreecommitdiffstats
path: root/StringTools/Test
diff options
context:
space:
mode:
Diffstat (limited to 'StringTools/Test')
-rw-r--r--StringTools/Test/Test.vcxproj1
-rw-r--r--StringTools/Test/Test.vcxproj.filters3
-rw-r--r--StringTools/Test/Upper.cpp200
3 files changed, 204 insertions, 0 deletions
diff --git a/StringTools/Test/Test.vcxproj b/StringTools/Test/Test.vcxproj
index 59e804a..b94c55a 100644
--- a/StringTools/Test/Test.vcxproj
+++ b/StringTools/Test/Test.vcxproj
@@ -165,6 +165,7 @@
<ClCompile Include="Lower.cpp" />
<ClCompile Include="Replace_Char.cpp" />
<ClCompile Include="Replace_String.cpp" />
+ <ClCompile Include="Upper.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/StringTools/Test/Test.vcxproj.filters b/StringTools/Test/Test.vcxproj.filters
index c10488e..10b98cf 100644
--- a/StringTools/Test/Test.vcxproj.filters
+++ b/StringTools/Test/Test.vcxproj.filters
@@ -24,5 +24,8 @@
<ClCompile Include="Lower.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
+ <ClCompile Include="Upper.cpp">
+ <Filter>Quelldateien</Filter>
+ </ClCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/StringTools/Test/Upper.cpp b/StringTools/Test/Upper.cpp
new file mode 100644
index 0000000..cbefee7
--- /dev/null
+++ b/StringTools/Test/Upper.cpp
@@ -0,0 +1,200 @@
+#include "CppUnitTest.h"
+#include "../StringTools/StringTools.h"
+
+using namespace Microsoft::VisualStudio::CppUnitTestFramework;
+
+namespace _StringTools
+{
+ TEST_CLASS(_Upper)
+ {
+ public:
+
+ // Tests that uppering an empty string returns an empty string
+ TEST_METHOD(EmptyString)
+ {
+ // Setup
+ const std::string in = "";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("", out.c_str());
+ return;
+ }
+
+ // Tests that uppering a string without any letters returns an itself
+ TEST_METHOD(Symbols)
+ {
+ // Setup
+ const std::string in = "66! _-\n*";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("66! _-\n*", out.c_str());
+ return;
+ }
+
+ // Tests that uppering a string of uppercase letters returns itself
+ TEST_METHOD(AlreadyUppered)
+ {
+ // Setup
+ const std::string in = "UGHAREYOUSERIOUS";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("UGHAREYOUSERIOUS", out.c_str());
+ return;
+ }
+
+ // Tests that uppering a string of lowercase letters returns the uppercase version
+ TEST_METHOD(Lowercase)
+ {
+ // Setup
+ const std::string in = "ughareyouserious";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("UGHAREYOUSERIOUS", out.c_str());
+ return;
+ }
+
+ // Tests that uppering a string of uppercase, lowercase letters and symbols returns the uppercase version
+ TEST_METHOD(Mixed)
+ {
+ // Setup
+ const std::string in = "Ugh, Are You Serious?! DON'T do that!!!";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("UGH, ARE YOU SERIOUS?! DON'T DO THAT!!!", out.c_str());
+ return;
+ }
+
+ // Tests that uppering already uppered umlautes returns itself
+ TEST_METHOD(Umlautes_already_upper_a)
+ {
+ // Setup
+ const std::string in = "ÄÁÀÂ";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("ÄÁÀÂ", out.c_str());
+ }
+
+ // Tests that uppering uppercase umlautes returns the upper umlautes
+ TEST_METHOD(Umlautes_upper_a)
+ {
+ // Setup
+ const std::string in = "äáàâ";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("ÄÁÀÂ", out.c_str());
+ }
+
+ // Tests that uppering already uppered umlautes returns itself
+ TEST_METHOD(Umlautes_already_upper_e)
+ {
+ // Setup
+ const std::string in = "ÉÈÊ";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("ÉÈÊ", out.c_str());
+ }
+
+ // Tests that uppering uppercase umlautes returns the upper umlautes
+ TEST_METHOD(Umlautes_upper_e)
+ {
+ // Setup
+ const std::string in = "éèê";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("ÉÈÊ", out.c_str());
+ }
+
+ // Tests that uppering already uppered umlautes returns itself
+ TEST_METHOD(Umlautes_already_upper_u)
+ {
+ // Setup
+ const std::string in = "ÜÚÙÛ";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("ÜÚÙÛ", out.c_str());
+ }
+
+ // Tests that uppering uppercase umlautes returns the upper umlautes
+ TEST_METHOD(Umlautes_upper_u)
+ {
+ // Setup
+ const std::string in = "üúùû";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("ÜÚÙÛ", out.c_str());
+ }
+
+ // Tests that uppering already uppered umlautes returns itself
+ TEST_METHOD(Umlautes_already_upper_o)
+ {
+ // Setup
+ const std::string in = "ÖÓÒÔ";
+
+ // Exercise
+ const std::string out = StringTools::Upper(in);
+
+ // Verify
+ Assert::AreEqual("ÖÓÒÔ", out.c_str());
+ }
+
+ // Tests that uppering uppercase umlautes returns the upper umlautes
+ TEST_METHOD(Umlautes_upper_o)
+ {
+ // 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!!!";
+
+ // 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());
+ return;
+ }
+ };
+}