mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Split out the rest of string manipulation tests
This commit is contained in:
parent
fe967b1f41
commit
6da00c1b64
@ -1522,26 +1522,26 @@ Message.tests.cpp:<line number>: passed: true
|
||||
Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
|
||||
Misc.tests.cpp:<line number>: passed: b != a for: 2 != 1
|
||||
Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
|
||||
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "b", "z" ) for: true
|
||||
String.tests.cpp:<line number>: passed: letters == "azcdefcg" for: "azcdefcg" == "azcdefcg"
|
||||
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "c", "z" ) for: true
|
||||
String.tests.cpp:<line number>: passed: letters == "abzdefzg" for: "abzdefzg" == "abzdefzg"
|
||||
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "a", "z" ) for: true
|
||||
String.tests.cpp:<line number>: passed: letters == "zbcdefcg" for: "zbcdefcg" == "zbcdefcg"
|
||||
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "g", "z" ) for: true
|
||||
String.tests.cpp:<line number>: passed: letters == "abcdefcz" for: "abcdefcz" == "abcdefcz"
|
||||
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, letters, "replaced" ) for: true
|
||||
String.tests.cpp:<line number>: passed: letters == "replaced" for: "replaced" == "replaced"
|
||||
String.tests.cpp:<line number>: passed: !(Catch::replaceInPlace( letters, "x", "z" )) for: !false
|
||||
String.tests.cpp:<line number>: passed: letters == letters for: "abcdefcg" == "abcdefcg"
|
||||
String.tests.cpp:<line number>: passed: Catch::replaceInPlace( s, "'", "|'" ) for: true
|
||||
String.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t"
|
||||
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "b", "z") for: true
|
||||
StringManip.tests.cpp:<line number>: passed: letters == "azcdefcg" for: "azcdefcg" == "azcdefcg"
|
||||
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "c", "z") for: true
|
||||
StringManip.tests.cpp:<line number>: passed: letters == "abzdefzg" for: "abzdefzg" == "abzdefzg"
|
||||
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "a", "z") for: true
|
||||
StringManip.tests.cpp:<line number>: passed: letters == "zbcdefcg" for: "zbcdefcg" == "zbcdefcg"
|
||||
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "g", "z") for: true
|
||||
StringManip.tests.cpp:<line number>: passed: letters == "abcdefcz" for: "abcdefcz" == "abcdefcz"
|
||||
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, letters, "replaced") for: true
|
||||
StringManip.tests.cpp:<line number>: passed: letters == "replaced" for: "replaced" == "replaced"
|
||||
StringManip.tests.cpp:<line number>: passed: !(Catch::replaceInPlace(letters, "x", "z")) for: !false
|
||||
StringManip.tests.cpp:<line number>: passed: letters == letters for: "abcdefcg" == "abcdefcg"
|
||||
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(s, "'", "|'") for: true
|
||||
StringManip.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t"
|
||||
Misc.tests.cpp:<line number>: failed: false with 1 message: '3'
|
||||
Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7'
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) for: { ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." )
|
||||
String.tests.cpp:<line number>: passed: splitStringRef("", ',' ), Equals(std::vector<StringRef>() ) for: { } Equals: { }
|
||||
String.tests.cpp:<line number>: passed: splitStringRef("abc", ',' ), Equals(std::vector<StringRef>{"abc"} ) for: { abc } Equals: { abc }
|
||||
String.tests.cpp:<line number>: passed: splitStringRef("abc,def", ',' ), Equals(std::vector<StringRef>{"abc", "def"} ) for: { abc, def } Equals: { abc, def }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def }
|
||||
Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 1 to 3...' and '1' and '2' and '3'
|
||||
Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 4 to 6...' and '4' and '5' and '6'
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( emptyMap ) == "{ }" for: "{ }" == "{ }"
|
||||
|
@ -11441,15 +11441,15 @@ with expansion:
|
||||
replaceInPlace
|
||||
replace single char
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
StringManip.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( Catch::replaceInPlace(letters, "b", "z") )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( letters == "azcdefcg" )
|
||||
with expansion:
|
||||
"azcdefcg" == "azcdefcg"
|
||||
@ -11458,15 +11458,15 @@ with expansion:
|
||||
replaceInPlace
|
||||
replace two chars
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
StringManip.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( Catch::replaceInPlace(letters, "c", "z") )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( letters == "abzdefzg" )
|
||||
with expansion:
|
||||
"abzdefzg" == "abzdefzg"
|
||||
@ -11475,15 +11475,15 @@ with expansion:
|
||||
replaceInPlace
|
||||
replace first char
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
StringManip.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( Catch::replaceInPlace(letters, "a", "z") )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( letters == "zbcdefcg" )
|
||||
with expansion:
|
||||
"zbcdefcg" == "zbcdefcg"
|
||||
@ -11492,15 +11492,15 @@ with expansion:
|
||||
replaceInPlace
|
||||
replace last char
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
StringManip.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( Catch::replaceInPlace(letters, "g", "z") )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( letters == "abcdefcz" )
|
||||
with expansion:
|
||||
"abcdefcz" == "abcdefcz"
|
||||
@ -11509,15 +11509,15 @@ with expansion:
|
||||
replaceInPlace
|
||||
replace all chars
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
StringManip.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( Catch::replaceInPlace(letters, letters, "replaced") )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( letters == "replaced" )
|
||||
with expansion:
|
||||
"replaced" == "replaced"
|
||||
@ -11526,15 +11526,15 @@ with expansion:
|
||||
replaceInPlace
|
||||
replace no chars
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
StringManip.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK_FALSE( Catch::replaceInPlace(letters, "x", "z") )
|
||||
with expansion:
|
||||
!false
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( letters == letters )
|
||||
with expansion:
|
||||
"abcdefcg" == "abcdefcg"
|
||||
@ -11543,15 +11543,15 @@ with expansion:
|
||||
replaceInPlace
|
||||
escape '
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
StringManip.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( Catch::replaceInPlace(s, "'", "|'") )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( s == "didn|'t" )
|
||||
with expansion:
|
||||
"didn|'t" == "didn|'t"
|
||||
@ -11602,20 +11602,20 @@ with expansion:
|
||||
-------------------------------------------------------------------------------
|
||||
splitString
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
StringManip.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( splitStringRef("", ','), Equals(std::vector<StringRef>()) )
|
||||
with expansion:
|
||||
{ } Equals: { }
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) )
|
||||
with expansion:
|
||||
{ abc } Equals: { abc }
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) )
|
||||
with expansion:
|
||||
{ abc, def } Equals: { abc, def }
|
||||
|
@ -13732,9 +13732,9 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="replaceInPlace" tags="[StringManip][Strings]" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="replace single char" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<TestCase name="replaceInPlace" tags="[string-manip]" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Section name="replace single char" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
Catch::replaceInPlace(letters, "b", "z")
|
||||
</Original>
|
||||
@ -13742,7 +13742,7 @@ loose text artifact
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
letters == "azcdefcg"
|
||||
</Original>
|
||||
@ -13752,8 +13752,8 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="replace two chars" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="replace two chars" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
Catch::replaceInPlace(letters, "c", "z")
|
||||
</Original>
|
||||
@ -13761,7 +13761,7 @@ loose text artifact
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
letters == "abzdefzg"
|
||||
</Original>
|
||||
@ -13771,8 +13771,8 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="replace first char" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="replace first char" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
Catch::replaceInPlace(letters, "a", "z")
|
||||
</Original>
|
||||
@ -13780,7 +13780,7 @@ loose text artifact
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
letters == "zbcdefcg"
|
||||
</Original>
|
||||
@ -13790,8 +13790,8 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="replace last char" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="replace last char" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
Catch::replaceInPlace(letters, "g", "z")
|
||||
</Original>
|
||||
@ -13799,7 +13799,7 @@ loose text artifact
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
letters == "abcdefcz"
|
||||
</Original>
|
||||
@ -13809,8 +13809,8 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="replace all chars" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="replace all chars" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
Catch::replaceInPlace(letters, letters, "replaced")
|
||||
</Original>
|
||||
@ -13818,7 +13818,7 @@ loose text artifact
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
letters == "replaced"
|
||||
</Original>
|
||||
@ -13828,8 +13828,8 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="replace no chars" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK_FALSE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="replace no chars" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Expression success="true" type="CHECK_FALSE" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
!(Catch::replaceInPlace(letters, "x", "z"))
|
||||
</Original>
|
||||
@ -13837,7 +13837,7 @@ loose text artifact
|
||||
!false
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
letters == letters
|
||||
</Original>
|
||||
@ -13847,8 +13847,8 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="escape '" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="escape '" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
Catch::replaceInPlace(s, "'", "|'")
|
||||
</Original>
|
||||
@ -13856,7 +13856,7 @@ loose text artifact
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
s == "didn|'t"
|
||||
</Original>
|
||||
@ -13913,8 +13913,8 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="splitString" tags="[Strings]" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<TestCase name="splitString" tags="[string-manip]" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
splitStringRef("", ','), Equals(std::vector<StringRef>())
|
||||
</Original>
|
||||
@ -13922,7 +13922,7 @@ loose text artifact
|
||||
{ } Equals: { }
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"})
|
||||
</Original>
|
||||
@ -13930,7 +13930,7 @@ loose text artifact
|
||||
{ abc } Equals: { abc }
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
|
||||
<Original>
|
||||
splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"})
|
||||
</Original>
|
||||
|
@ -160,48 +160,3 @@ TEST_CASE( "StringRef", "[Strings][StringRef]" ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE( "replaceInPlace", "[Strings][StringManip]" ) {
|
||||
std::string letters = "abcdefcg";
|
||||
SECTION( "replace single char" ) {
|
||||
CHECK( Catch::replaceInPlace( letters, "b", "z" ) );
|
||||
CHECK( letters == "azcdefcg" );
|
||||
}
|
||||
SECTION( "replace two chars" ) {
|
||||
CHECK( Catch::replaceInPlace( letters, "c", "z" ) );
|
||||
CHECK( letters == "abzdefzg" );
|
||||
}
|
||||
SECTION( "replace first char" ) {
|
||||
CHECK( Catch::replaceInPlace( letters, "a", "z" ) );
|
||||
CHECK( letters == "zbcdefcg" );
|
||||
}
|
||||
SECTION( "replace last char" ) {
|
||||
CHECK( Catch::replaceInPlace( letters, "g", "z" ) );
|
||||
CHECK( letters == "abcdefcz" );
|
||||
}
|
||||
SECTION( "replace all chars" ) {
|
||||
CHECK( Catch::replaceInPlace( letters, letters, "replaced" ) );
|
||||
CHECK( letters == "replaced" );
|
||||
}
|
||||
SECTION( "replace no chars" ) {
|
||||
CHECK_FALSE( Catch::replaceInPlace( letters, "x", "z" ) );
|
||||
CHECK( letters == letters );
|
||||
}
|
||||
SECTION( "escape '" ) {
|
||||
std::string s = "didn't";
|
||||
CHECK( Catch::replaceInPlace( s, "'", "|'" ) );
|
||||
CHECK( s == "didn|'t" );
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE( "splitString", "[Strings]" ) {
|
||||
using namespace Catch::Matchers;
|
||||
using Catch::splitStringRef;
|
||||
using Catch::StringRef;
|
||||
|
||||
CHECK_THAT( splitStringRef("", ',' ), Equals(std::vector<StringRef>() ) );
|
||||
CHECK_THAT( splitStringRef("abc", ',' ), Equals(std::vector<StringRef>{"abc"} ) );
|
||||
CHECK_THAT( splitStringRef("abc,def", ',' ), Equals(std::vector<StringRef>{"abc", "def"} ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,3 +22,46 @@ TEST_CASE("Trim strings", "[string-manip]") {
|
||||
REQUIRE(trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace));
|
||||
REQUIRE(trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace));
|
||||
}
|
||||
|
||||
TEST_CASE("replaceInPlace", "[string-manip]") {
|
||||
std::string letters = "abcdefcg";
|
||||
SECTION("replace single char") {
|
||||
CHECK(Catch::replaceInPlace(letters, "b", "z"));
|
||||
CHECK(letters == "azcdefcg");
|
||||
}
|
||||
SECTION("replace two chars") {
|
||||
CHECK(Catch::replaceInPlace(letters, "c", "z"));
|
||||
CHECK(letters == "abzdefzg");
|
||||
}
|
||||
SECTION("replace first char") {
|
||||
CHECK(Catch::replaceInPlace(letters, "a", "z"));
|
||||
CHECK(letters == "zbcdefcg");
|
||||
}
|
||||
SECTION("replace last char") {
|
||||
CHECK(Catch::replaceInPlace(letters, "g", "z"));
|
||||
CHECK(letters == "abcdefcz");
|
||||
}
|
||||
SECTION("replace all chars") {
|
||||
CHECK(Catch::replaceInPlace(letters, letters, "replaced"));
|
||||
CHECK(letters == "replaced");
|
||||
}
|
||||
SECTION("replace no chars") {
|
||||
CHECK_FALSE(Catch::replaceInPlace(letters, "x", "z"));
|
||||
CHECK(letters == letters);
|
||||
}
|
||||
SECTION("escape '") {
|
||||
std::string s = "didn't";
|
||||
CHECK(Catch::replaceInPlace(s, "'", "|'"));
|
||||
CHECK(s == "didn|'t");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("splitString", "[string-manip]") {
|
||||
using namespace Catch::Matchers;
|
||||
using Catch::splitStringRef;
|
||||
using Catch::StringRef;
|
||||
|
||||
CHECK_THAT(splitStringRef("", ','), Equals(std::vector<StringRef>()));
|
||||
CHECK_THAT(splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}));
|
||||
CHECK_THAT(splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user