summaryrefslogtreecommitdiffstats
path: root/Test/String__Split.cpp
diff options
context:
space:
mode:
authorLeonetienne <leon@etiennes.de>2022-05-16 23:57:26 +0200
committerLeonetienne <leon@etiennes.de>2022-05-16 23:57:26 +0200
commit954629f6bc3b7753c5be0c08e0cdb5caf1056d23 (patch)
tree33a95f60202135f9fcc689e081a64f2d274d7d99 /Test/String__Split.cpp
parent1fe3eeb14470470d8c95c40c98a12c15320bcd57 (diff)
Adhere to new project structure
Diffstat (limited to 'Test/String__Split.cpp')
-rw-r--r--Test/String__Split.cpp156
1 files changed, 0 insertions, 156 deletions
diff --git a/Test/String__Split.cpp b/Test/String__Split.cpp
deleted file mode 100644
index 9da8e94..0000000
--- a/Test/String__Split.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-#include <StringTools.h>
-#include "Catch2.h"
-
-// Tests that splitting an empty string always returns {""}
-TEST_CASE(__FILE__"/EmptyString", "[Strings][Split]")
-{
- SECTION("Empty seperator") {
- // Setup
- const std::string in = "";
- const std::string sep = "";
-
- // Exercise
- const std::vector<std::string> out = StringTools::Split(in, sep);
-
- // Verify
- REQUIRE(out.size() == 1);
- REQUIRE(out[0] == "");
- }
-
- SECTION("Nonempty seperator") {
- // Setup
- const std::string in = "";
- const std::string sep = ",";
-
- // Exercise
- const std::vector<std::string> out = StringTools::Split(in, sep);
-
- // Verify
- REQUIRE(out.size() == 1);
- REQUIRE(out[0] == "");
- }
-
-
- return;
-}
-
-// Tests that splitting a string with an empty seperator returns all the chars
-TEST_CASE(__FILE__"/EmptySeperator", "[Strings][Split]")
-{
- // Setup
- const std::string in = "hello world";
- const std::string sep = "";
- const std::vector<std::string> expected = { "h", "e", "l", "l", "o", " ", "w", "o", "r", "l", "d" };
-
- // Exercise
- const std::vector<std::string> out = StringTools::Split(in, sep);
-
- // Verify
- REQUIRE(out == expected);
-
- return;
-}
-
-// Tests that splitting a string with a single-char seperator works
-TEST_CASE(__FILE__"/SingleCharSeperator", "[Strings][Split]")
-{
- // Setup
- const std::string in = "0,1,2,3,4,5,6,7,8,9";
- const std::string sep = ",";
- const std::vector<std::string> expected = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
-
- // Exercise
- const std::vector<std::string> out = StringTools::Split(in, sep);
-
- // Verify
- REQUIRE(out == expected);
-
- return;
-}
-
-// Tests that having seperators next to each other gets empty strings
-TEST_CASE(__FILE__"/SingleCharSeperatorsNextToEachOther", "[Strings][Split]")
-{
- // Setup
- const std::string in = "0,1,,3";
- const std::string sep = ",";
- const std::vector<std::string> expected = { "0", "1", "", "3" };
-
- // Exercise
- const std::vector<std::string> out = StringTools::Split(in, sep);
-
- // Verify
- REQUIRE(out == expected);
-
- return;
-}
-
-// Tests that having seperators at index 0 and -1 returns empty strings
-TEST_CASE(__FILE__"/SingleCharSeperatorsAtExtremePoints", "[Strings][Split]")
-{
- // Setup
- const std::string in = ",0,1,2,";
- const std::string sep = ",";
- const std::vector<std::string> expected = { "", "0", "1", "2", "" };
-
- // Exercise
- const std::vector<std::string> out = StringTools::Split(in, sep);
-
- // Verify
- REQUIRE(out == expected);
-
- return;
-}
-
-
-// Tests that splitting a string with a multi-char seperator works
-TEST_CASE(__FILE__"/MultiCharSeperator", "[Strings][Split]")
-{
- // Setup
- const std::string in = "0;;1;;2;;3;;4;;5;;6;;7;;8;;9";
- const std::string sep = ";;";
- const std::vector<std::string> expected = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
-
- // Exercise
- const std::vector<std::string> out = StringTools::Split(in, sep);
-
- // Verify
- REQUIRE(out == expected);
-
- return;
-}
-
-// Tests that having seperators next to each other gets empty strings
-TEST_CASE(__FILE__"/MultiCharSeperatorsNextToEachOther", "[Strings][Split]")
-{
- // Setup
- const std::string in = "0;;1;;;;3";
- const std::string sep = ";;";
- const std::vector<std::string> expected = { "0", "1", "", "3" };
-
- // Exercise
- const std::vector<std::string> out = StringTools::Split(in, sep);
-
- // Verify
- REQUIRE(out == expected);
-
- return;
-}
-
-// Tests that having seperators at index 0 and -1 returns empty strings
-TEST_CASE(__FILE__"/MultiCharSeperatorsAtExtremePoints", "[Strings][Split]")
-{
- // Setup
- const std::string in = ";;0;;1;;2;;";
- const std::string sep = ";;";
- const std::vector<std::string> expected = { "", "0", "1", "2", "" };
-
- // Exercise
- const std::vector<std::string> out = StringTools::Split(in, sep);
-
- // Verify
- REQUIRE(out == expected);
-
- return;
-}
-