added umlaut support for Lower/Upper for îíì
This commit is contained in:
@@ -89,6 +89,9 @@ std::string StringTools::Lower(const std::string& str)
|
|||||||
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
|
|
||||||
// Else: keep the character as is
|
// Else: keep the character as is
|
||||||
else ss << c;
|
else ss << c;
|
||||||
@@ -125,6 +128,9 @@ std::string StringTools::Upper(const std::string& str)
|
|||||||
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
|
else if (c == '<EFBFBD>') ss << '<EFBFBD>';
|
||||||
|
|
||||||
// Else: keep the character as is
|
// Else: keep the character as is
|
||||||
else ss << c;
|
else ss << c;
|
||||||
|
@@ -183,17 +183,43 @@ namespace _StringTools
|
|||||||
Assert::AreEqual("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", out.c_str());
|
Assert::AreEqual("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", out.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that lowering a string of uppercase, lowercase letters and symbols returns the lowercase version, even with umlauts
|
// Tests that lowering already lowered umlautes returns itself
|
||||||
TEST_METHOD(Mixed_with_umlautes)
|
TEST_METHOD(Umlautes_already_lower_i)
|
||||||
{
|
{
|
||||||
// Setup
|
// Setup
|
||||||
const std::string in = "<EFBFBD>gh, <20>r<EFBFBD> Y<><59> Seri<72><69>s?! D<>N'T D<> TH<54>T!!!";
|
const std::string in = "<EFBFBD><EFBFBD><EFBFBD>";
|
||||||
|
|
||||||
// Exercise
|
// Exercise
|
||||||
const std::string out = StringTools::Lower(in);
|
const std::string out = StringTools::Lower(in);
|
||||||
|
|
||||||
// Verify
|
// Verify
|
||||||
Assert::AreEqual("<EFBFBD>gh, <20>r<EFBFBD> y<><79> seri<72><69>s?! d<>n't d<> th<74>t!!!", out.c_str());
|
Assert::AreEqual("<EFBFBD><EFBFBD><EFBFBD>", out.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests that lowering uppercase umlautes returns the lowered umlautes
|
||||||
|
TEST_METHOD(Umlautes_upper_i)
|
||||||
|
{
|
||||||
|
// Setup
|
||||||
|
const std::string in = "<EFBFBD><EFBFBD><EFBFBD>";
|
||||||
|
|
||||||
|
// Exercise
|
||||||
|
const std::string out = StringTools::Lower(in);
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
Assert::AreEqual("<EFBFBD><EFBFBD><EFBFBD>", 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 = "<EFBFBD>gh, <20>r<EFBFBD> Y<><59> Ser<65><72><EFBFBD>s?! D<>N'T D<> TH<54>T!!!";
|
||||||
|
|
||||||
|
// Exercise
|
||||||
|
const std::string out = StringTools::Lower(in);
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
Assert::AreEqual("<EFBFBD>gh, <20>r<EFBFBD> y<><79> ser<65><72><EFBFBD>s?! d<>n't d<> th<74>t!!!", out.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -183,17 +183,43 @@ namespace _StringTools
|
|||||||
Assert::AreEqual("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", out.c_str());
|
Assert::AreEqual("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", out.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that uppering a string of uppercase, lowercase letters and symbols returns the lowercase version, even with umlauts
|
// Tests that lowering already lowered umlautes returns itself
|
||||||
TEST_METHOD(Mixed_with_umlautes)
|
TEST_METHOD(Umlautes_already_upper_i)
|
||||||
{
|
{
|
||||||
// Setup
|
// Setup
|
||||||
const std::string in = "<EFBFBD>gh, <20>r<EFBFBD> Y<><59> Seri<72><69>s?! D<>N'T D<> TH<54>T!!!";
|
const std::string in = "<EFBFBD><EFBFBD><EFBFBD>";
|
||||||
|
|
||||||
// Exercise
|
// Exercise
|
||||||
const std::string out = StringTools::Upper(in);
|
const std::string out = StringTools::Upper(in);
|
||||||
|
|
||||||
// Verify
|
// Verify
|
||||||
Assert::AreEqual("<EFBFBD>GH, <20>R<EFBFBD> Y<><59> SERI<52><49>S?! D<>N'T D<> TH<54>T!!!", out.c_str());
|
Assert::AreEqual("<EFBFBD><EFBFBD><EFBFBD>", out.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests that lowering uppercase umlautes returns the lowered umlautes
|
||||||
|
TEST_METHOD(Umlautes_upper_i)
|
||||||
|
{
|
||||||
|
// Setup
|
||||||
|
const std::string in = "<EFBFBD><EFBFBD><EFBFBD>";
|
||||||
|
|
||||||
|
// Exercise
|
||||||
|
const std::string out = StringTools::Upper(in);
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
Assert::AreEqual("<EFBFBD><EFBFBD><EFBFBD>", 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 = "<EFBFBD>gh, <20>r<EFBFBD> Y<><59> Ser<65><72><EFBFBD>s?! D<>N'T D<> TH<54>T!!!";
|
||||||
|
|
||||||
|
// Exercise
|
||||||
|
const std::string out = StringTools::Upper(in);
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
Assert::AreEqual("<EFBFBD>GH, <20>R<EFBFBD> Y<><59> SER<45><52><EFBFBD>S?! D<>N'T D<> TH<54>T!!!", out.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user