mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Removed String and StringBuilder
This commit is contained in:
@@ -1020,6 +1020,6 @@ with expansion:
|
||||
"{?}" == "1"
|
||||
|
||||
===============================================================================
|
||||
test cases: 183 | 132 passed | 47 failed | 4 failed as expected
|
||||
assertions: 908 | 791 passed | 96 failed | 21 failed as expected
|
||||
test cases: 181 | 130 passed | 47 failed | 4 failed as expected
|
||||
assertions: 876 | 759 passed | 96 failed | 21 failed as expected
|
||||
|
||||
|
@@ -4257,50 +4257,6 @@ MatchersTests.cpp:<line number>: FAILED:
|
||||
with expansion:
|
||||
"this string contains 'abc' as a substring" starts with: "string"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
String
|
||||
empty string
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( empty.empty() )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( empty.size() == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
String.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( std::strcmp( empty.c_str(), "" ) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
String
|
||||
from literal
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s.empty() == false )
|
||||
with expansion:
|
||||
false == false
|
||||
|
||||
String.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s.size() == 5 )
|
||||
with expansion:
|
||||
5 == 5
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
String matchers
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -4331,172 +4287,6 @@ PASSED:
|
||||
with expansion:
|
||||
"this string contains 'abc' as a substring" ends with: "substring"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder
|
||||
basic
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( sb.capacity() == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( sb.size() == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( sb.capacity() == 32 )
|
||||
with expansion:
|
||||
32 == 32
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( sb.size() == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( sb.capacity() == 32 )
|
||||
with expansion:
|
||||
32 == 32
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( sb.size() == 5 )
|
||||
with expansion:
|
||||
5 == 5
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s == "hello" )
|
||||
with expansion:
|
||||
hello == "hello"
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s.size() == 5 )
|
||||
with expansion:
|
||||
5 == 5
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder
|
||||
concatenation
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s == "hello world" )
|
||||
with expansion:
|
||||
hello world == "hello world"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder
|
||||
concat & move
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s == "hello world" )
|
||||
with expansion:
|
||||
hello world == "hello world"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder
|
||||
reserved
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( sb16.capacity() == 16 )
|
||||
with expansion:
|
||||
16 == 16
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( sb16.capacity() == 16 )
|
||||
with expansion:
|
||||
16 == 16
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s == "hello world" )
|
||||
with expansion:
|
||||
hello world == "hello world"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder
|
||||
from String
|
||||
copy
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s2 == s )
|
||||
with expansion:
|
||||
hello == hello
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s2.c_str() != s.c_str() )
|
||||
with expansion:
|
||||
"hello" != "hello"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder
|
||||
from String
|
||||
move from uniquely owned string
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s2 == "hello" )
|
||||
with expansion:
|
||||
hello == "hello"
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s2.c_str() == originalPointer )
|
||||
with expansion:
|
||||
"hello" == "hello"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder
|
||||
from String
|
||||
move from shared string (copies)
|
||||
-------------------------------------------------------------------------------
|
||||
StringBuilder.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s2 == "hello" )
|
||||
with expansion:
|
||||
hello == "hello"
|
||||
|
||||
StringBuilder.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( s2.c_str() != originalPointer )
|
||||
with expansion:
|
||||
"hello" != "hello"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Empty string
|
||||
@@ -4744,70 +4534,6 @@ PASSED:
|
||||
with expansion:
|
||||
hello != cello
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
From string
|
||||
Copied
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringRef.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( copied == "hot potato" )
|
||||
with expansion:
|
||||
hot potato == "hot potato"
|
||||
|
||||
StringRef.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( str == "hot potato" )
|
||||
with expansion:
|
||||
hot potato == "hot potato"
|
||||
|
||||
StringRef.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( isOwned( copied ) == false )
|
||||
with expansion:
|
||||
false == false
|
||||
|
||||
StringRef.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( data( copied ) == originalPointer )
|
||||
with expansion:
|
||||
"hot potato" == "hot potato"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
From string
|
||||
Moved
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringRef.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( copied == "hot potato" )
|
||||
with expansion:
|
||||
hot potato == "hot potato"
|
||||
|
||||
StringRef.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( isOwned( copied ) )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
StringRef.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( str.empty() )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
StringRef.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( data( copied ) == originalPointer )
|
||||
with expansion:
|
||||
"hot potato" == "hot potato"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
from std::string
|
||||
@@ -7737,6 +7463,6 @@ MiscTests.cpp:<line number>:
|
||||
PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 183 | 129 passed | 50 failed | 4 failed as expected
|
||||
assertions: 910 | 787 passed | 102 failed | 21 failed as expected
|
||||
test cases: 181 | 127 passed | 50 failed | 4 failed as expected
|
||||
assertions: 878 | 755 passed | 102 failed | 21 failed as expected
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="15" failures="88" tests="911" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="15" failures="88" tests="879" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}">
|
||||
<error type="TEST_CASE">
|
||||
@@ -505,16 +505,7 @@ Message from section two
|
||||
MatchersTests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="String/empty string" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="String/from literal" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="String matchers" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringBuilder/basic" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringBuilder/concatenation" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringBuilder/concat & move" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringBuilder/reserved" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringBuilder/from String/copy" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringBuilder/from String/move from uniquely owned string" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringBuilder/from String/move from shared string (copies)" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/Empty string" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/From string literal" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/From string literal/c_str() does not cause copy" time="{duration}"/>
|
||||
@@ -529,8 +520,6 @@ StringRef.tests.cpp:<line number>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/Substrings/Pointer values of full refs should match" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/Substrings/Pointer values of substring refs should not match" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/Comparisons" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/From string/Copied" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/From string/Moved" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/from std::string/implicitly constructed" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/from std::string/explicitly constructed" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/from std::string/assigned" time="{duration}"/>
|
||||
|
@@ -4860,55 +4860,6 @@ Message from section two
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="String" tags="[Strings]" filename="projects/<exe-name>/String.tests.cpp" >
|
||||
<Section name="empty string" filename="projects/<exe-name>/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/String.tests.cpp" >
|
||||
<Original>
|
||||
empty.empty()
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/String.tests.cpp" >
|
||||
<Original>
|
||||
empty.size() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/String.tests.cpp" >
|
||||
<Original>
|
||||
std::strcmp( empty.c_str(), "" ) == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="from literal" filename="projects/<exe-name>/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/String.tests.cpp" >
|
||||
<Original>
|
||||
s.empty() == false
|
||||
</Original>
|
||||
<Expanded>
|
||||
false == false
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/String.tests.cpp" >
|
||||
<Original>
|
||||
s.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="String matchers" tags="[matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
@@ -4944,191 +4895,6 @@ Message from section two
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="StringBuilder" tags="[Strings]" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Section name="basic" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
sb.capacity() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
sb.size() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
sb.capacity() == 32
|
||||
</Original>
|
||||
<Expanded>
|
||||
32 == 32
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
sb.size() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
sb.capacity() == 32
|
||||
</Original>
|
||||
<Expanded>
|
||||
32 == 32
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
sb.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s == "hello"
|
||||
</Original>
|
||||
<Expanded>
|
||||
hello == "hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="8" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="concatenation" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s == "hello world"
|
||||
</Original>
|
||||
<Expanded>
|
||||
hello world == "hello world"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="concat & move" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s == "hello world"
|
||||
</Original>
|
||||
<Expanded>
|
||||
hello world == "hello world"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="reserved" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
sb16.capacity() == 16
|
||||
</Original>
|
||||
<Expanded>
|
||||
16 == 16
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
sb16.capacity() == 16
|
||||
</Original>
|
||||
<Expanded>
|
||||
16 == 16
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s == "hello world"
|
||||
</Original>
|
||||
<Expanded>
|
||||
hello world == "hello world"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="from String" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Section name="copy" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s2 == s
|
||||
</Original>
|
||||
<Expanded>
|
||||
hello == hello
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s2.c_str() != s.c_str()
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello" != "hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="from String" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Section name="move from uniquely owned string" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s2 == "hello"
|
||||
</Original>
|
||||
<Expanded>
|
||||
hello == "hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s2.c_str() == originalPointer
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello" == "hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="from String" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Section name="move from shared string (copies)" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s2 == "hello"
|
||||
</Original>
|
||||
<Expanded>
|
||||
hello == "hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringBuilder.tests.cpp" >
|
||||
<Original>
|
||||
s2.c_str() != originalPointer
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello" != "hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="StringRef" tags="[Strings]" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Section name="Empty string" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
@@ -5407,82 +5173,6 @@ Message from section two
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="From string" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Section name="Copied" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Original>
|
||||
copied == "hot potato"
|
||||
</Original>
|
||||
<Expanded>
|
||||
hot potato == "hot potato"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Original>
|
||||
str == "hot potato"
|
||||
</Original>
|
||||
<Expanded>
|
||||
hot potato == "hot potato"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Original>
|
||||
isOwned( copied ) == false
|
||||
</Original>
|
||||
<Expanded>
|
||||
false == false
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Original>
|
||||
data( copied ) == originalPointer
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hot potato" == "hot potato"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="From string" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Section name="Moved" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Original>
|
||||
copied == "hot potato"
|
||||
</Original>
|
||||
<Expanded>
|
||||
hot potato == "hot potato"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Original>
|
||||
isOwned( copied )
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Original>
|
||||
str.empty()
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Original>
|
||||
data( copied ) == originalPointer
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hot potato" == "hot potato"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="from std::string" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Section name="implicitly constructed" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
|
||||
@@ -8568,7 +8258,7 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="787" failures="103" expectedFailures="21"/>
|
||||
<OverallResults successes="755" failures="103" expectedFailures="21"/>
|
||||
</Group>
|
||||
<OverallResults successes="787" failures="102" expectedFailures="21"/>
|
||||
<OverallResults successes="755" failures="102" expectedFailures="21"/>
|
||||
</Catch>
|
||||
|
@@ -1,22 +0,0 @@
|
||||
#include "../include/internal/catch_string.h"
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
TEST_CASE( "String", "[Strings]" ) {
|
||||
using Catch::String;
|
||||
|
||||
SECTION( "empty string" ) {
|
||||
String empty;
|
||||
REQUIRE( empty.empty() );
|
||||
REQUIRE( empty.size() == 0 );
|
||||
REQUIRE( std::strcmp( empty.c_str(), "" ) == 0 );
|
||||
}
|
||||
SECTION( "from literal" ) {
|
||||
String s = "hello";
|
||||
REQUIRE( s.empty() == false );
|
||||
REQUIRE( s.size() == 5 );
|
||||
}
|
||||
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
#include "internal/catch_stringbuilder.h"
|
||||
#include "../include/internal/catch_stringref.h"
|
||||
#include "../include/internal/catch_string.h"
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
TEST_CASE( "StringBuilder", "[Strings]" ) {
|
||||
|
||||
using Catch::StringBuilder;
|
||||
using Catch::String;
|
||||
|
||||
StringBuilder sb;
|
||||
|
||||
SECTION( "basic" ) {
|
||||
REQUIRE( sb.capacity() == 0 );
|
||||
REQUIRE( sb.size() == 0 );
|
||||
|
||||
sb.reserve( 32 );
|
||||
REQUIRE( sb.capacity() == 32 );
|
||||
REQUIRE( sb.size() == 0 );
|
||||
|
||||
sb.append( "hello" );
|
||||
REQUIRE( sb.capacity() == 32 );
|
||||
REQUIRE( sb.size() == 5 );
|
||||
|
||||
String s = std::move( sb );
|
||||
REQUIRE( s == "hello" );
|
||||
REQUIRE( s.size() == 5 );
|
||||
}
|
||||
|
||||
SECTION( "concatenation" ) {
|
||||
sb << "hello" << " " << "world";
|
||||
String s = std::move( sb );
|
||||
REQUIRE( s == "hello world" );
|
||||
}
|
||||
|
||||
SECTION( "concat & move" ) {
|
||||
String s = StringBuilder() << "hello" << " " << "world";
|
||||
REQUIRE( s == "hello world" );
|
||||
}
|
||||
|
||||
SECTION( "reserved" ) {
|
||||
StringBuilder sb16( 16 );
|
||||
REQUIRE( sb16.capacity() == 16 );
|
||||
sb16 << "hello" << " " << "world";
|
||||
REQUIRE( sb16.capacity() == 16 );
|
||||
String s = std::move( sb16 );
|
||||
REQUIRE( s == "hello world" );
|
||||
}
|
||||
|
||||
SECTION( "from String" ) {
|
||||
String s = "hello";
|
||||
|
||||
SECTION( "copy" ) {
|
||||
StringBuilder sb2 = s;
|
||||
String s2( std::move(sb2) );
|
||||
REQUIRE( s2 == s );
|
||||
REQUIRE( s2.c_str() != s.c_str() );
|
||||
}
|
||||
SECTION( "move from uniquely owned string" ) {
|
||||
auto originalPointer = s.c_str();
|
||||
StringBuilder sb2( std::move( s ) );
|
||||
String s2( std::move(sb2) );
|
||||
REQUIRE( s2 == "hello" );
|
||||
REQUIRE( s2.c_str() == originalPointer );
|
||||
}
|
||||
SECTION( "move from shared string (copies)" ) {
|
||||
auto originalPointer = s.c_str();
|
||||
String keepAlive = s;
|
||||
StringBuilder sb2( std::move( s ) );
|
||||
String s2( std::move(sb2) );
|
||||
REQUIRE( s2 == "hello" );
|
||||
REQUIRE( s2.c_str() != originalPointer );
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,4 @@
|
||||
#include "../include/internal/catch_stringref.h"
|
||||
#include "../include/internal/catch_string.h"
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
@@ -40,8 +39,7 @@ namespace Catch {
|
||||
TEST_CASE( "StringRef", "[Strings]" ) {
|
||||
|
||||
using Catch::StringRef;
|
||||
using Catch::String;
|
||||
|
||||
|
||||
SECTION( "Empty string" ) {
|
||||
StringRef empty;
|
||||
REQUIRE( empty.empty() );
|
||||
@@ -124,32 +122,6 @@ TEST_CASE( "StringRef", "[Strings]" ) {
|
||||
REQUIRE( StringRef("hello") == StringRef("hello") );
|
||||
REQUIRE( StringRef("hello") != StringRef("cello") );
|
||||
}
|
||||
|
||||
SECTION( "From string" ) {
|
||||
String str = "hot potato";
|
||||
auto originalPointer = str.c_str();
|
||||
|
||||
SECTION( "Copied" ) {
|
||||
// After a String is "copied" to a StringRef
|
||||
// It has only copied the pointer and size
|
||||
// - it does not take ownership
|
||||
StringRef copied = str;
|
||||
REQUIRE( copied == "hot potato" );
|
||||
REQUIRE( str == "hot potato" );
|
||||
REQUIRE( isOwned( copied ) == false );
|
||||
REQUIRE( data( copied ) == originalPointer );
|
||||
}
|
||||
SECTION( "Moved" ) {
|
||||
// After a String is *moved* to a StringRef
|
||||
// The StringRef takes ownership of the underlying data
|
||||
// and the String is left in an empty state
|
||||
StringRef copied = std::move( str );
|
||||
REQUIRE( copied == "hot potato" );
|
||||
REQUIRE( isOwned( copied ) );
|
||||
REQUIRE( str.empty() );
|
||||
REQUIRE( data( copied ) == originalPointer );
|
||||
}
|
||||
}
|
||||
|
||||
SECTION( "from std::string" ) {
|
||||
std::string stdStr = "a standard string";
|
||||
|
Reference in New Issue
Block a user