summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Src/CharTools.cpp34
-rw-r--r--Src/CharTools.h18
-rw-r--r--Test/CMakeLists.txt20
-rw-r--r--Test/Char__CopySign.cpp69
-rw-r--r--Test/Char__IsDigit.cpp20
-rw-r--r--Test/Char__IsLetter.cpp19
-rw-r--r--Test/Char__IsLower.cpp19
-rw-r--r--Test/Char__IsUpper.cpp20
-rw-r--r--Test/Char__IsVowel.cpp19
-rw-r--r--Test/Char__MakeLower.cpp47
-rw-r--r--Test/Char__MakeUpper.cpp47
-rw-r--r--Test/String__Lower.cpp (renamed from Test/Lower.cpp)10
-rw-r--r--Test/String__Replace_Char.cpp (renamed from Test/Replace_Char.cpp)22
-rw-r--r--Test/String__Replace_String.cpp (renamed from Test/Replace_String.cpp)24
-rw-r--r--Test/String__Upper.cpp (renamed from Test/Upper.cpp)10
15 files changed, 334 insertions, 64 deletions
diff --git a/Src/CharTools.cpp b/Src/CharTools.cpp
index 79cc679..5a7028c 100644
--- a/Src/CharTools.cpp
+++ b/Src/CharTools.cpp
@@ -2,11 +2,13 @@
#include <algorithm>
bool CharTools::IsVowel(const char c, const std::string &vowels) {
+ const char lc = MakeLower(c);
+
return std::any_of(
vowels.cbegin(),
vowels.cend(),
- [c](const char vowel) {
- return c == vowel;
+ [lc](const char vowel) {
+ return lc == vowel;
}
);
}
@@ -18,19 +20,28 @@ bool CharTools::IsLetter(const char c) {
return (lowercase_c >= 'a') && (lowercase_c <= 'z');
}
-bool CharTools::IsGeneric(const char c) {
- return (c == UPPERCASE) || (c == LOWERCASE);
+bool CharTools::IsDigit(const char c) {
+ return (c >= '0') && (c <= '9');
}
bool CharTools::IsUpper(const char c) {
- if ((!IsLetter(c)) && (!IsGeneric(c)))
+ if (!IsLetter(c))
return false;
else
return !(c & (1<<5));
}
+bool CharTools::IsLower(const char c) {
+ // Can't just return !IsUpper(c), because it should still return false for digits and symbols...
+
+ if (!IsLetter(c))
+ return false;
+ else
+ return (c & (1<<5));
+}
+
char CharTools::MakeUpper(char c) {
- if ((!IsLetter(c)) && (!IsGeneric(c)))
+ if (!IsLetter(c))
return c;
else if (IsUpper(c))
return c;
@@ -39,7 +50,7 @@ char CharTools::MakeUpper(char c) {
}
char CharTools::MakeLower(char c) {
- if ((!IsLetter(c)) && (!IsGeneric(c)))
+ if (!IsLetter(c))
return c;
else if (!IsUpper(c))
return c;
@@ -47,15 +58,8 @@ char CharTools::MakeLower(char c) {
return c | (1<<5);
}
-char CharTools::GetSign(char c) {
- if (IsUpper(c))
- return UPPERCASE;
- else
- return LOWERCASE;
-}
-
char CharTools::CopySign(char sign, char c) {
- if ((!IsLetter(c)) && (!IsGeneric(c)))
+ if ((!IsLetter(c)) || (!IsLetter(sign)))
return c;
if (IsUpper(sign))
return MakeUpper(c);
diff --git a/Src/CharTools.h b/Src/CharTools.h
index 3d7f255..66c32c0 100644
--- a/Src/CharTools.h
+++ b/Src/CharTools.h
@@ -8,34 +8,28 @@
class CharTools {
public:
//! Checks whether or not `c` is a vowel. You can define custom vowel characters.
- static bool IsVowel(const char c, const std::string& vowels = "euioay");
+ static bool IsVowel(const char c, const std::string &vowels = "euioay");
//! Returns whether or not `c` is a letter.
static bool IsLetter(const char c);
- //! Returns whether or not `c` is a generic character (that contains JUST the sign)
- static bool IsGeneric(const char c);
+ //! Returns whether or not `c` is a digit.
+ static bool IsDigit(const char c);
//! Checks whether or not `c` is an uppercase character.
static bool IsUpper(const char c);
+ //! Checks whether or not `c` is a lowercase character.
+ static bool IsLower(const char c);
+
//! Will return `c` as an uppercase character.
static char MakeUpper(char c);
//! Will return `c` as a lowercase character.
static char MakeLower(char c);
- //! Will return an empty character with the same sign/capitalization as `c`.
- static char GetSign(char c);
-
//! Will return `c` with the same capitalization as `sign`.
static char CopySign(char sign, char c);
-
- //! Generic uppercase character.
- static constexpr char UPPERCASE = 0;
-
- //! Generic lowercase character.
- static constexpr char LOWERCASE = (1<<5);
};
#endif //STRINGTOOLS_CHARTOOLS_H
diff --git a/Test/CMakeLists.txt b/Test/CMakeLists.txt
index 31793bb..d4d3ea1 100644
--- a/Test/CMakeLists.txt
+++ b/Test/CMakeLists.txt
@@ -9,10 +9,22 @@ link_directories(../Src/cmake-build-debug)
add_executable(Test
Catch2.h
main.cpp
- Lower.cpp
- Upper.cpp
- Replace_Char.cpp
- Replace_String.cpp
+
+ # StringTools-Tests
+ String__Lower.cpp
+ String__Upper.cpp
+ String__Replace_Char.cpp
+ String__Replace_String.cpp
+
+ # CharTools-Tests
+ Char__IsVowel.cpp
+ Char__IsLetter.cpp
+ Char__IsDigit.cpp
+ Char__IsUpper.cpp
+ Char__IsLower.cpp
+ Char__MakeUpper.cpp
+ Char__MakeLower.cpp
+ Char__CopySign.cpp
)
target_link_libraries(Test StringTools)
diff --git a/Test/Char__CopySign.cpp b/Test/Char__CopySign.cpp
new file mode 100644
index 0000000..b205575
--- /dev/null
+++ b/Test/Char__CopySign.cpp
@@ -0,0 +1,69 @@
+#include <CharTools.h>
+#include "Catch2.h"
+
+TEST_CASE(__FILE__"/JustChars", "[Char][CopySign]")
+{
+ // Setup
+ // Correct letters
+ const std::string in = "tHEEuEUROPEanunioNCOnsiStsOFStATESIncLudingGERmanySWedenAndfRanCE";
+ // Correct signs
+ const std::string signs = "AaaAAApqlkzicZnionceroigjreiojiopjaopickwapPjfipojWqfpohoijFucmwp";
+ // Correct signs and letters
+ const std::string expected = "TheEUEuropeanUnionconsistsofstatesincludingGermanySwedenandFrance";
+
+ // Exercise
+ std::string out = in;
+ for (std::size_t i = 0; i < in.size(); i++)
+ {
+ const char cs = signs[i];
+ char& co = out[i];
+ co = CharTools::CopySign(cs, co);
+ }
+
+ // Verify:
+ REQUIRE(out == expected);
+}
+
+TEST_CASE(__FILE__"/WithSymbols", "[Char][CopySign]")
+{
+ // Setup
+ // Correct letters
+ const std::string in = "ThE eu (euRoPeAN uNIon) cONsiSts Of 20 STAtes, iNCLUDInG GeRMAnY, sweden, aND fRancE.";
+ // Correct signs
+ const std::string signs = "DwefOPerKofkaqdioJeriofgjqeiopqwqefijoqgehjloivxcvmopfkuoQpwfioqjiOqgjeprjgnvqPemrqij";
+ // Correct signs and letters
+ const std::string expected = "The EU (European Union) consists of 20 states, including Germany, Sweden, and France.";
+
+ // Exercise
+ std::string out = in;
+ for (std::size_t i = 0; i < in.size(); i++)
+ {
+ const char cs = signs[i];
+ char& co = out[i];
+ co = CharTools::CopySign(cs, co);
+ }
+
+ // Verify:
+ REQUIRE(out == expected);
+}
+
+TEST_CASE(__FILE__"/DoesntChangeSignsIfSymbolSupplied", "[Char][CopySign]")
+{
+ // Setup
+ const std::string in = "ThE eu (euRoPeAN uNIon) cONsiSts Of 20 STAtes, iNCLUDInG GeRMAnY, sweden, aND fRancE.";
+ const std::string signs = "!§$)=%164)';:'*?)/!?/&()()?)*'_;:_,.93ß04750928372!!$==)()/!§$)=%)*'';:'*?)/!1572?/&(";
+ const std::string expected = in;
+
+ // Exercise
+ std::string out = in;
+ for (std::size_t i = 0; i < in.size(); i++)
+ {
+ const char cs = signs[i];
+
+ char& co = out[i];
+ co = CharTools::CopySign(cs, co);
+ }
+
+ // Verify:
+ REQUIRE(out == expected);
+} \ No newline at end of file
diff --git a/Test/Char__IsDigit.cpp b/Test/Char__IsDigit.cpp
new file mode 100644
index 0000000..a388f98
--- /dev/null
+++ b/Test/Char__IsDigit.cpp
@@ -0,0 +1,20 @@
+#include <CharTools.h>
+#include "Catch2.h"
+
+// Tests character digit-ness by checking it against a map
+TEST_CASE(__FILE__"/MapTest", "[Char][IsUpper]")
+{
+ // Setup
+ const std::string in = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHJIKLMNOPQRSTUVWXYZ!&/()=?*'#-.,;:_";
+ const std::string map = "000000000000000000000000001111111111000000000000000000000000000000000000000000";
+ // 0 -> no digit, 1 -> digit
+
+ // Verify that I didn't frick up compiling the map by hand
+ if (in.length() != map.length())
+ FAIL("map.size() does not match in.size(). (" << in.length() << " : " << map.length() << ")");
+
+ // Exercise & Verify
+ for (std::size_t i = 0; i < in.size(); i++)
+ if (CharTools::IsDigit(in[i]) != (map[i] == '1'))
+ FAIL("'" << in[i] << "' differs from the map. Map says '" << map[i] << "', 1-> is a digit. Check first if the map is wrong, before trying to debug.");
+}
diff --git a/Test/Char__IsLetter.cpp b/Test/Char__IsLetter.cpp
new file mode 100644
index 0000000..08f27a6
--- /dev/null
+++ b/Test/Char__IsLetter.cpp
@@ -0,0 +1,19 @@
+#include <CharTools.h>
+#include "Catch2.h"
+
+// Tests character letter-ness by checking it against a map
+TEST_CASE(__FILE__"/MapTest", "[Char][IsLetter]")
+{
+ // Setup
+ const std::string in = "New album 'Cowboy Tears' out February 18! I am excited!";
+ const std::string map = "1110111110011111101111100111011111111000001011011111110"; // 0 -> no letter, 1 -> letter
+
+ // Verify that I didn't frick up compiling the map by hand
+ if (in.length() != map.length())
+ FAIL("map.size() does not match in.size(). (" << in.length() << " : " << map.length() << ")");
+
+ // Exercise & Verify
+ for (std::size_t i = 0; i < in.size(); i++)
+ if (CharTools::IsLetter(in[i]) != (map[i] == '1'))
+ FAIL("'" << in[i] << "' differs from the map. Map says '" << map[i] << "', 1-> is a letter. Check first if the map is wrong, before trying to debug.");
+}
diff --git a/Test/Char__IsLower.cpp b/Test/Char__IsLower.cpp
new file mode 100644
index 0000000..69390f4
--- /dev/null
+++ b/Test/Char__IsLower.cpp
@@ -0,0 +1,19 @@
+#include <CharTools.h>
+#include "Catch2.h"
+
+// Tests character sign by checking it against a map
+TEST_CASE(__FILE__"/MapTest", "[Char][IsLower]")
+{
+ // Setup
+ const std::string in = "New album 'Cowboy Tears' out February 18! I am excited!";
+ const std::string map = "0110111110001111100111100111001111111000000011011111110"; // 1 -> lowercase, 0 -> not lowercase
+
+ // Verify that I didn't frick up compiling the map by hand
+ if (in.length() != map.length())
+ FAIL("map.size() does not match in.size(). (" << in.length() << " : " << map.length() << ")");
+
+ // Exercise & Verify
+ for (std::size_t i = 0; i < in.size(); i++)
+ if (CharTools::IsLower(in[i]) != (map[i] == '1'))
+ FAIL("'" << in[i] << "' differs from the map. Map says '" << map[i] << "', 1-> is a lowercase. Check first if the map is wrong, before trying to debug.");
+}
diff --git a/Test/Char__IsUpper.cpp b/Test/Char__IsUpper.cpp
new file mode 100644
index 0000000..6bc10b3
--- /dev/null
+++ b/Test/Char__IsUpper.cpp
@@ -0,0 +1,20 @@
+#include <CharTools.h>
+#include "Catch2.h"
+#include <iostream>
+
+// Tests character sign by checking it against a map
+TEST_CASE(__FILE__"/MapTest", "[Char][IsUpper]")
+{
+ // Setup
+ const std::string in = "New album 'Cowboy Tears' out February 18! I am excited!";
+ const std::string map = "1000000000010000001000000000010000000000001000000000000"; // 1 -> uppercase, 0 -> not uppercase
+
+ // Verify that I didn't frick up compiling the map by hand
+ if (in.length() != map.length())
+ FAIL("map.size() does not match in.size(). (" << in.length() << " : " << map.length() << ")");
+
+ // Exercise & Verify
+ for (std::size_t i = 0; i < in.size(); i++)
+ if (CharTools::IsUpper(in[i]) != (map[i] == '1'))
+ FAIL("'" << in[i] << "' differs from the map. Map says '" << map[i] << "', 1-> is an uppercase. Check first if the map is wrong, before trying to debug.");
+}
diff --git a/Test/Char__IsVowel.cpp b/Test/Char__IsVowel.cpp
new file mode 100644
index 0000000..31e281d
--- /dev/null
+++ b/Test/Char__IsVowel.cpp
@@ -0,0 +1,19 @@
+#include <CharTools.h>
+#include "Catch2.h"
+
+// Tests character vowel-ness by checking it against a map
+TEST_CASE(__FILE__"/MapTest", "[Char][IsVowel]")
+{
+ // Setup
+ const std::string in = "New album 'Cowboy Tears' out February 18! I am excited!";
+ const std::string map = "0100100100001001100110000110001001101000001010010010100"; // 0 -> no vowel, 1 -> vowel
+
+ // Verify that I didn't frick up compiling the map by hand
+ if (in.length() != map.length())
+ FAIL("map.size() does not match in.size(). (" << in.length() << " : " << map.length() << ")");
+
+ // Exercise & Verify
+ for (std::size_t i = 0; i < in.size(); i++)
+ if (CharTools::IsVowel(in[i]) != (map[i] == '1'))
+ FAIL("'" << in[i] << "' differs from the map. Map says '" << map[i] << "', 1-> is a vowel. Check first if the map is wrong, before trying to debug.");
+}
diff --git a/Test/Char__MakeLower.cpp b/Test/Char__MakeLower.cpp
new file mode 100644
index 0000000..524992d
--- /dev/null
+++ b/Test/Char__MakeLower.cpp
@@ -0,0 +1,47 @@
+#include <CharTools.h>
+#include "Catch2.h"
+
+TEST_CASE(__FILE__"/LowerToUpper_NoSymbols", "[Char][MakeLower]")
+{
+ // Setup
+ const std::string in = "NEWALBUMCOWBOYTEARSOUTFEBRUARYIAMEXCITED";
+ const std::string expected = "newalbumcowboytearsoutfebruaryiamexcited";
+
+ // Exercise
+ std::string out = in;
+ for (char& c : out)
+ c = CharTools::MakeLower(c);
+
+ // Verify:
+ REQUIRE(out == expected);
+}
+
+TEST_CASE(__FILE__"/LowerToUpper_Symbols", "[Char][MakeLower]")
+{
+ // Setup
+ const std::string in = "NEW ALBUM 'COWBOY TEARS' OUT FEBRUARY 18! I AM EXCITED!";
+ const std::string expected = "new album 'cowboy tears' out february 18! i am excited!";
+
+ // Exercise
+ std::string out = in;
+ for (char& c : out)
+ c = CharTools::MakeLower(c);
+
+ // Verify:
+ REQUIRE(out == expected);
+}
+
+TEST_CASE(__FILE__"/LowerToUpper_Mixed_And_Symbols", "[Char][MakeLower]")
+{
+ // Setup
+ const std::string in = "New album 'Cowboy Tears' out February 18! I am excited!";
+ const std::string expected = "new album 'cowboy tears' out february 18! i am excited!";
+
+ // Exercise
+ std::string out = in;
+ for (char& c : out)
+ c = CharTools::MakeLower(c);
+
+ // Verify:
+ REQUIRE(out == expected);
+}
diff --git a/Test/Char__MakeUpper.cpp b/Test/Char__MakeUpper.cpp
new file mode 100644
index 0000000..8a808d8
--- /dev/null
+++ b/Test/Char__MakeUpper.cpp
@@ -0,0 +1,47 @@
+#include <CharTools.h>
+#include "Catch2.h"
+
+TEST_CASE(__FILE__"/LowerToUpper_NoSymbols", "[Char][MakeUpper]")
+{
+ // Setup
+ const std::string in = "newalbumcowboytearsoutfebruaryiamexcited";
+ const std::string expected = "NEWALBUMCOWBOYTEARSOUTFEBRUARYIAMEXCITED";
+
+ // Exercise
+ std::string out = in;
+ for (char& c : out)
+ c = CharTools::MakeUpper(c);
+
+ // Verify:
+ REQUIRE(out == expected);
+}
+
+TEST_CASE(__FILE__"/LowerToUpper_Symbols", "[Char][MakeUpper]")
+{
+ // Setup
+ const std::string in = "new album 'Cowboy Tears' out february 18! i am excited!";
+ const std::string expected = "NEW ALBUM 'COWBOY TEARS' OUT FEBRUARY 18! I AM EXCITED!";
+
+ // Exercise
+ std::string out = in;
+ for (char& c : out)
+ c = CharTools::MakeUpper(c);
+
+ // Verify:
+ REQUIRE(out == expected);
+}
+
+TEST_CASE(__FILE__"/LowerToUpper_Mixed_And_Symbols", "[Char][MakeUpper]")
+{
+ // Setup
+ const std::string in = "New album 'Cowboy Tears' out February 18! I am excited!";
+ const std::string expected = "NEW ALBUM 'COWBOY TEARS' OUT FEBRUARY 18! I AM EXCITED!";
+
+ // Exercise
+ std::string out = in;
+ for (char& c : out)
+ c = CharTools::MakeUpper(c);
+
+ // Verify:
+ REQUIRE(out == expected);
+}
diff --git a/Test/Lower.cpp b/Test/String__Lower.cpp
index 8e4fe27..c198394 100644
--- a/Test/Lower.cpp
+++ b/Test/String__Lower.cpp
@@ -2,7 +2,7 @@
#include "Catch2.h"
// Tests that lowering an empty string returns an empty string
-TEST_CASE(__FILE__"/EmptyString", "[Lower]")
+TEST_CASE(__FILE__"/EmptyString", "[Strings][Lower]")
{
// Setup
const std::string in = "";
@@ -16,7 +16,7 @@ TEST_CASE(__FILE__"/EmptyString", "[Lower]")
}
// Tests that lowering a string without any letters returns itself
-TEST_CASE(__FILE__"/Symbols", "[Lower]")
+TEST_CASE(__FILE__"/Symbols", "[Strings][Lower]")
{
// Setup
const std::string in = "66! _-\n*";
@@ -30,7 +30,7 @@ TEST_CASE(__FILE__"/Symbols", "[Lower]")
}
// Tests that lowering a string of lowercase letters returns itself
-TEST_CASE(__FILE__"/AlreadyLowered", "[Lower]")
+TEST_CASE(__FILE__"/AlreadyLowered", "[Strings][Lower]")
{
// Setup
const std::string in = "ughareyouserious";
@@ -44,7 +44,7 @@ TEST_CASE(__FILE__"/AlreadyLowered", "[Lower]")
}
// Tests that lowering a string of uppercase letters returns the lowercase version
-TEST_CASE(__FILE__"/Uppercase", "[Lower]")
+TEST_CASE(__FILE__"/Uppercase", "[Strings][Lower]")
{
// Setup
const std::string in = "UGHAREYOUSERIOUS";
@@ -58,7 +58,7 @@ TEST_CASE(__FILE__"/Uppercase", "[Lower]")
}
// Tests that lowering a string of uppercase, lowercase letters and symbols returns the lowercase version
-TEST_CASE(__FILE__"/Mixed", "[Lower]")
+TEST_CASE(__FILE__"/Mixed", "[Strings][Lower]")
{
// Setup
const std::string in = "Ugh, Are You Serious?! DON'T DO THAT!!!";
diff --git a/Test/Replace_Char.cpp b/Test/String__Replace_Char.cpp
index 72d5622..b935cc2 100644
--- a/Test/Replace_Char.cpp
+++ b/Test/String__Replace_Char.cpp
@@ -2,7 +2,7 @@
#include "Catch2.h"
// Tests that replacing something in an empty string returns an empty string
-TEST_CASE(__FILE__"/EmptyString", "[ReplaceChar]")
+TEST_CASE(__FILE__"/EmptyString", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "";
@@ -16,7 +16,7 @@ TEST_CASE(__FILE__"/EmptyString", "[ReplaceChar]")
}
// Tests that replacing a char to an empty string works
-TEST_CASE(__FILE__"/Single_ReplaceToEmpty", "[ReplaceChar]")
+TEST_CASE(__FILE__"/Single_ReplaceToEmpty", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "i";
@@ -30,7 +30,7 @@ TEST_CASE(__FILE__"/Single_ReplaceToEmpty", "[ReplaceChar]")
}
// Tests that replacing to a single char works
-TEST_CASE(__FILE__"/Single_ReplaceToSingleChar", "[ReplaceChar]")
+TEST_CASE(__FILE__"/Single_ReplaceToSingleChar", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "a";
@@ -44,7 +44,7 @@ TEST_CASE(__FILE__"/Single_ReplaceToSingleChar", "[ReplaceChar]")
}
// Tests that replacing to a single char works, passing a char
-TEST_CASE(__FILE__"/Single_ReplaceToSingleChar_AsChar", "[ReplaceChar]")
+TEST_CASE(__FILE__"/Single_ReplaceToSingleChar_AsChar", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "Oilbanger";
@@ -58,7 +58,7 @@ TEST_CASE(__FILE__"/Single_ReplaceToSingleChar_AsChar", "[ReplaceChar]")
}
// Tests that replacing the find to something longer works
-TEST_CASE(__FILE__"/Single_ReplaceToLonger", "[ReplaceChar]")
+TEST_CASE(__FILE__"/Single_ReplaceToLonger", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "Littled";
@@ -72,7 +72,7 @@ TEST_CASE(__FILE__"/Single_ReplaceToLonger", "[ReplaceChar]")
}
// Tests that replacing a char to an empty string works
-TEST_CASE(__FILE__"/Multiple_ReplaceToEmpty", "[ReplaceChar]")
+TEST_CASE(__FILE__"/Multiple_ReplaceToEmpty", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "dirty dogs dig dirt daringly";
@@ -86,7 +86,7 @@ TEST_CASE(__FILE__"/Multiple_ReplaceToEmpty", "[ReplaceChar]")
}
// Tests that replacing to a single char works
-TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar", "[ReplaceChar]")
+TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "Oilbanger, Bangerfanger, Lattle brattle oaly skattle.";
@@ -100,7 +100,7 @@ TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar", "[ReplaceChar]")
}
// Tests that replacing to a single char works, passing a char
-TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar_AsChar", "[ReplaceChar]")
+TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar_AsChar", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "Oilbanger, Bangerfanger, Lattle brattle oaly skattle.";
@@ -114,7 +114,7 @@ TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar_AsChar", "[ReplaceChar]")
}
// Tests that replacing the find to something longer works
-TEST_CASE(__FILE__"/Multiple_ReplaceToLonger", "[ReplaceChar]")
+TEST_CASE(__FILE__"/Multiple_ReplaceToLonger", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "d d d d d d d d";
@@ -128,7 +128,7 @@ TEST_CASE(__FILE__"/Multiple_ReplaceToLonger", "[ReplaceChar]")
}
// Tests that the replacer ignores chars put in by the replacer
-TEST_CASE(__FILE__"/ReplacerIgnoresReplaced", "[ReplaceChar]")
+TEST_CASE(__FILE__"/ReplacerIgnoresReplaced", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "b b b b b b b b";
@@ -142,7 +142,7 @@ TEST_CASE(__FILE__"/ReplacerIgnoresReplaced", "[ReplaceChar]")
}
// Tests that replacing succesive findings works
-TEST_CASE(__FILE__"/Replace_Successive", "[ReplaceChar]")
+TEST_CASE(__FILE__"/Replace_Successive", "[Strings][ReplaceChar]")
{
// Setup
const std::string in = "bbbbbbbb";
diff --git a/Test/Replace_String.cpp b/Test/String__Replace_String.cpp
index 853d411..7547fcd 100644
--- a/Test/Replace_String.cpp
+++ b/Test/String__Replace_String.cpp
@@ -2,7 +2,7 @@
#include "Catch2.h"
// Tests that replacing something in an empty string returns an empty string
-TEST_CASE(__FILE__"/EmptyString", "[ReplaceString]")
+TEST_CASE(__FILE__"/EmptyString", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "";
@@ -16,7 +16,7 @@ TEST_CASE(__FILE__"/EmptyString", "[ReplaceString]")
}
// Tests that replacing a string to an empty string works
-TEST_CASE(__FILE__"/Single_ReplaceToEmpty", "[ReplaceString]")
+TEST_CASE(__FILE__"/Single_ReplaceToEmpty", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "Squarepants";
@@ -30,7 +30,7 @@ TEST_CASE(__FILE__"/Single_ReplaceToEmpty", "[ReplaceString]")
}
// Tests that replacing to a single char works
-TEST_CASE(__FILE__"/Single_ReplaceToSingleChar", "[ReplaceString]")
+TEST_CASE(__FILE__"/Single_ReplaceToSingleChar", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "Squarepants";
@@ -44,7 +44,7 @@ TEST_CASE(__FILE__"/Single_ReplaceToSingleChar", "[ReplaceString]")
}
// Tests that replacing to a single char works, passing a char
-TEST_CASE(__FILE__"/Single_ReplaceToSingleChar_AsChar", "[ReplaceString]")
+TEST_CASE(__FILE__"/Single_ReplaceToSingleChar_AsChar", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "Oilbanger";
@@ -58,7 +58,7 @@ TEST_CASE(__FILE__"/Single_ReplaceToSingleChar_AsChar", "[ReplaceString]")
}
// Tests that replacing the find to something longer works
-TEST_CASE(__FILE__"/Single_ReplaceToLonger", "[ReplaceString]")
+TEST_CASE(__FILE__"/Single_ReplaceToLonger", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "LittleDong";
@@ -72,7 +72,7 @@ TEST_CASE(__FILE__"/Single_ReplaceToLonger", "[ReplaceString]")
}
// Tests that replacing a string to an empty string works
-TEST_CASE(__FILE__"/Multiple_ReplaceToEmpty", "[ReplaceString]")
+TEST_CASE(__FILE__"/Multiple_ReplaceToEmpty", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "The fucking dogs are fucking eating the fucking chicken.";
@@ -86,7 +86,7 @@ TEST_CASE(__FILE__"/Multiple_ReplaceToEmpty", "[ReplaceString]")
}
// Tests that replacing to a single char works
-TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar", "[ReplaceString]")
+TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "Oilbsmearynger, Bsmearyngerfsmearynger, Lsmearyttle brsmearyttle osmearyly sksmearyttle.";
@@ -100,7 +100,7 @@ TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar", "[ReplaceString]")
}
// Tests that replacing to a single char works, passing a char
-TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar_AsChar", "[ReplaceString]")
+TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar_AsChar", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "Oilbsmearynger, Bsmearyngerfsmearynger, Lsmearyttle brsmearyttle osmearyly sksmearyttle.";
@@ -114,7 +114,7 @@ TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar_AsChar", "[ReplaceString]")
}
// Tests that replacing the find to something longer works
-TEST_CASE(__FILE__"/Multiple_ReplaceToLonger", "[ReplaceString]")
+TEST_CASE(__FILE__"/Multiple_ReplaceToLonger", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "honk honk honk honk honk honk honk honk";
@@ -128,7 +128,7 @@ TEST_CASE(__FILE__"/Multiple_ReplaceToLonger", "[ReplaceString]")
}
// Tests that the replacer ignores chars put in by the replacer
-TEST_CASE(__FILE__"/ReplacerIgnoresReplaced", "[ReplaceString]")
+TEST_CASE(__FILE__"/ReplacerIgnoresReplaced", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "honk honk honk honk honk honk honk honk";
@@ -142,7 +142,7 @@ TEST_CASE(__FILE__"/ReplacerIgnoresReplaced", "[ReplaceString]")
}
// Tests that replacing successive findings works
-TEST_CASE(__FILE__"/Replace_Successive", "[ReplaceString]")
+TEST_CASE(__FILE__"/Replace_Successive", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "honkhonkhonkhonkhonkhonkhonkhonk";
@@ -156,7 +156,7 @@ TEST_CASE(__FILE__"/Replace_Successive", "[ReplaceString]")
}
// Tests that if find.length() == 0, it returns just the input
-TEST_CASE(__FILE__"/Find_Length0_Returns_Input", "[ReplaceString]")
+TEST_CASE(__FILE__"/Find_Length0_Returns_Input", "[Strings][ReplaceString]")
{
// Setup
const std::string in = "Littled";
diff --git a/Test/Upper.cpp b/Test/String__Upper.cpp
index 8d34fa2..37fe7b7 100644
--- a/Test/Upper.cpp
+++ b/Test/String__Upper.cpp
@@ -2,7 +2,7 @@
#include "Catch2.h"
// Tests that uppering an empty string returns an empty string
-TEST_CASE(__FILE__"/EmptyString", "[Upper]")
+TEST_CASE(__FILE__"/EmptyString", "[Strings][Upper]")
{
// Setup
const std::string in = "";
@@ -16,7 +16,7 @@ TEST_CASE(__FILE__"/EmptyString", "[Upper]")
}
// Tests that uppering a string without any letters returns itself
-TEST_CASE(__FILE__"/Symbols", "[Upper]")
+TEST_CASE(__FILE__"/Symbols", "[Strings][Upper]")
{
// Setup
const std::string in = "66! _-\n*";
@@ -30,7 +30,7 @@ TEST_CASE(__FILE__"/Symbols", "[Upper]")
}
// Tests that uppering a string of uppercase letters returns itself
-TEST_CASE(__FILE__"/AlreadyUppered", "[Upper]")
+TEST_CASE(__FILE__"/AlreadyUppered", "[Strings][Upper]")
{
// Setup
const std::string in = "UGHAREYOUSERIOUS";
@@ -44,7 +44,7 @@ TEST_CASE(__FILE__"/AlreadyUppered", "[Upper]")
}
// Tests that uppering a string of lowercase letters returns the uppercase version
-TEST_CASE(__FILE__"/Lowercase", "[Upper]")
+TEST_CASE(__FILE__"/Lowercase", "[Strings][Upper]")
{
// Setup
const std::string in = "ughareyouserious";
@@ -58,7 +58,7 @@ TEST_CASE(__FILE__"/Lowercase", "[Upper]")
}
// Tests that uppering a string of uppercase, lowercase letters and symbols returns the uppercase version
-TEST_CASE(__FILE__"/Mixed", "[Upper]")
+TEST_CASE(__FILE__"/Mixed", "[Strings][Upper]")
{
// Setup
const std::string in = "Ugh, Are You Serious?! DON'T do that!!!";