From 7726d64530f82fc9b8ac08f484491335bd7ca2a4 Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Sat, 12 Feb 2022 16:04:48 +0100 Subject: Optimized directory structure --- Src/Test/Replace_String.cpp | 170 -------------------------------------------- 1 file changed, 170 deletions(-) delete mode 100644 Src/Test/Replace_String.cpp (limited to 'Src/Test/Replace_String.cpp') diff --git a/Src/Test/Replace_String.cpp b/Src/Test/Replace_String.cpp deleted file mode 100644 index f2ef15c..0000000 --- a/Src/Test/Replace_String.cpp +++ /dev/null @@ -1,170 +0,0 @@ -#include -#include "Catch2.h" - -// Tests that replacing something in an empty string returns an empty string -TEST_CASE(__FILE__"/EmptyString", "[ReplaceString]") -{ - // Setup - const std::string in = ""; - - // Exercise - const std::string out = StringTools::Replace(in, "burger", "Subst"); - - // Verify - REQUIRE(out == ""); - return; -} - -// Tests that replacing a string to an empty string works -TEST_CASE(__FILE__"/Single_ReplaceToEmpty", "[ReplaceString]") -{ - // Setup - const std::string in = "Squarepants"; - - // Exercise - const std::string out = StringTools::Replace(in, "Squarepants", ""); - - // Verify - REQUIRE(out == ""); - return; -} - -// Tests that replacing to a single char works -TEST_CASE(__FILE__"/Single_ReplaceToSingleChar", "[ReplaceString]") -{ - // Setup - const std::string in = "Squarepants"; - - // Exercise - const std::string out = StringTools::Replace(in, "Squarepants", "i"); - - // Verify - REQUIRE(out == "i"); - return; -} - -// Tests that replacing to a single char works, passing a char -TEST_CASE(__FILE__"/Single_ReplaceToSingleChar_AsChar", "[ReplaceString]") -{ - // Setup - const std::string in = "Oilbanger"; - - // Exercise - const std::string out = StringTools::Replace(in, "Oilbanger", 'i'); - - // Verify - REQUIRE(out == "i"); - return; -} - -// Tests that replacing the find to something longer works -TEST_CASE(__FILE__"/Single_ReplaceToLonger", "[ReplaceString]") -{ - // Setup - const std::string in = "LittleDong"; - - // Exercise - const std::string out = StringTools::Replace(in, "Dong", "Binger"); - - // Verify - REQUIRE(out == "LittleBinger"); - return; -} - -// Tests that replacing a string to an empty string works -TEST_CASE(__FILE__"/Multiple_ReplaceToEmpty", "[ReplaceString]") -{ - // Setup - const std::string in = "The fucking dogs are fucking eating the fucking chicken."; - - // Exercise - const std::string out = StringTools::Replace(in, "fucking ", ""); - - // Verify - REQUIRE(out == "The dogs are eating the chicken."); - return; -} - -// Tests that replacing to a single char works -TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar", "[ReplaceString]") -{ - // Setup - const std::string in = "Oilbsmearynger, Bsmearyngerfsmearynger, Lsmearyttle brsmearyttle osmearyly sksmearyttle."; - - // Exercise - const std::string out = StringTools::Replace(in, "smeary", "i"); - - // Verify - REQUIRE(out == "Oilbinger, Bingerfinger, Little brittle oily skittle."); - return; -} - -// Tests that replacing to a single char works, passing a char -TEST_CASE(__FILE__"/Multiple_ReplaceToSingleChar_AsChar", "[ReplaceString]") -{ - // Setup - const std::string in = "Oilbsmearynger, Bsmearyngerfsmearynger, Lsmearyttle brsmearyttle osmearyly sksmearyttle."; - - // Exercise - const std::string out = StringTools::Replace(in, "smeary", 'i'); - - // Verify - REQUIRE(out == "Oilbinger, Bingerfinger, Little brittle oily skittle."); - return; -} - -// Tests that replacing the find to something longer works -TEST_CASE(__FILE__"/Multiple_ReplaceToLonger", "[ReplaceString]") -{ - // Setup - const std::string in = "honk honk honk honk honk honk honk honk"; - - // Exercise - const std::string out = StringTools::Replace(in, "honk", "hallery"); - - // Verify - REQUIRE(out == "hallery hallery hallery hallery hallery hallery hallery hallery"); - return; -} - -// Tests that the replacer ignores chars put in by the replacer -TEST_CASE(__FILE__"/ReplacerIgnoresReplaced", "[ReplaceString]") -{ - // Setup - const std::string in = "honk honk honk honk honk honk honk honk"; - - // Exercise - const std::string out = StringTools::Replace(in, "honk", "honka"); - - // Verify - REQUIRE(out == "honka honka honka honka honka honka honka honka"); - return; -} - -// Tests that replacing successive findings works -TEST_CASE(__FILE__"/Replace_Successive", "[ReplaceString]") -{ - // Setup - const std::string in = "honkhonkhonkhonkhonkhonkhonkhonk"; - - // Exercise - const std::string out = StringTools::Replace(in, "honk", "hallery"); - - // Verify - REQUIRE(out == "halleryhalleryhalleryhalleryhalleryhalleryhalleryhallery"); - return; -} - -// Tests that if find.length() == 0, it returns just the input -TEST_CASE(__FILE__"/Find_Length0_Returns_Input", "[ReplaceString]") -{ - // Setup - const std::string in = "Littled"; - - // Exercise - const std::string out = StringTools::Replace(in, "", "binger"); - - // Verify - REQUIRE(out == "Littled"); - return; -} -- cgit v1.2.3