Added string tests to approvals

This commit is contained in:
Phil Nash 2017-06-29 11:19:08 +01:00
parent 78e7994435
commit 60f25c7ffd
4 changed files with 1184 additions and 7 deletions

View File

@ -1002,6 +1002,6 @@ with expansion:
"first" == "second"
===============================================================================
test cases: 171 | 121 passed | 46 failed | 4 failed as expected
assertions: 844 | 729 passed | 94 failed | 21 failed as expected
test cases: 174 | 124 passed | 46 failed | 4 failed as expected
assertions: 908 | 793 passed | 94 failed | 21 failed as expected

View File

@ -5692,6 +5692,50 @@ 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
-------------------------------------------------------------------------------
@ -5722,6 +5766,504 @@ 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"
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"
-------------------------------------------------------------------------------
StringBuilder
concat & move
-------------------------------------------------------------------------------
StringBuilder.tests.cpp:<line number>
...............................................................................
StringBuilder.tests.cpp:<line number>:
PASSED:
REQUIRE( s == "hello world" )
with expansion:
{?} == "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"
-------------------------------------------------------------------------------
StringBuilder
from String
copy
-------------------------------------------------------------------------------
StringBuilder.tests.cpp:<line number>
...............................................................................
StringBuilder.tests.cpp:<line number>:
PASSED:
REQUIRE( s2 == s )
with expansion:
{?} == {?}
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"
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"
StringBuilder.tests.cpp:<line number>:
PASSED:
REQUIRE( s2.c_str() != originalPointer )
with expansion:
"hello" != "hello"
-------------------------------------------------------------------------------
StringRef
Empty string
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( empty.empty() )
with expansion:
true
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( empty.size() == 0 )
with expansion:
0 == 0
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( std::strcmp( empty.c_str(), "" ) == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
StringRef
From string literal
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( s.empty() == false )
with expansion:
false == false
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( s.size() == 5 )
with expansion:
5 == 5
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isSubstring( s ) == false )
with expansion:
false == false
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( std::strcmp( rawChars, "hello" ) == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
StringRef
From string literal
c_str() does not cause copy
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isOwned( s ) == false )
with expansion:
false == false
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( s.c_str() == rawChars )
with expansion:
"hello" == "hello"
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isOwned( s ) == false )
with expansion:
false == false
-------------------------------------------------------------------------------
StringRef
From sub-string
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( original == "original" )
with expansion:
{?} == "original"
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isSubstring( original ) )
with expansion:
true
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isOwned( original ) == false )
with expansion:
false == false
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isSubstring( original ) == false )
with expansion:
false == false
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isOwned( original ) )
with expansion:
true
-------------------------------------------------------------------------------
StringRef
Substrings
zero-based substring
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( ss.empty() == false )
with expansion:
false == false
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( ss.size() == 5 )
with expansion:
5 == 5
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( std::strcmp( ss.c_str(), "hello" ) == 0 )
with expansion:
0 == 0
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( ss == "hello" )
with expansion:
{?} == "hello"
-------------------------------------------------------------------------------
StringRef
Substrings
c_str() causes copy
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isSubstring( ss ) )
with expansion:
true
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isOwned( ss ) == false )
with expansion:
false == false
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( rawChars == data( s ) )
with expansion:
"hello world!" == "hello world!"
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( ss.c_str() != rawChars )
with expansion:
"hello" != "hello world!"
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isSubstring( ss ) == false )
with expansion:
false == false
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( isOwned( ss ) )
with expansion:
true
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( data( ss ) != data( s ) )
with expansion:
"hello" != "hello world!"
-------------------------------------------------------------------------------
StringRef
Substrings
non-zero-based substring
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( ss.size() == 6 )
with expansion:
6 == 6
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( std::strcmp( ss.c_str(), "world!" ) == 0 )
with expansion:
0 == 0
-------------------------------------------------------------------------------
StringRef
Substrings
Pointer values of full refs should match
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( s.c_str() == s2.c_str() )
with expansion:
"hello world!" == "hello world!"
-------------------------------------------------------------------------------
StringRef
Substrings
Pointer values of substring refs should not match
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( s.c_str() != ss.c_str() )
with expansion:
"hello world!" != "hello"
-------------------------------------------------------------------------------
StringRef
Comparisons
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( StringRef("hello") == StringRef("hello") )
with expansion:
{?} == {?}
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( StringRef("hello") != StringRef("cello") )
with expansion:
{?} != {?}
-------------------------------------------------------------------------------
StringRef
From string
Copied
-------------------------------------------------------------------------------
StringRef.tests.cpp:<line number>
...............................................................................
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( copied == "hot potato" )
with expansion:
{?} == "hot potato"
StringRef.tests.cpp:<line number>:
PASSED:
REQUIRE( str == "hot potato" )
with expansion:
{?} == "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"
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"
hello
hello
-------------------------------------------------------------------------------
@ -8352,6 +8894,6 @@ MiscTests.cpp:<line number>:
PASSED:
===============================================================================
test cases: 171 | 120 passed | 47 failed | 4 failed as expected
assertions: 846 | 729 passed | 96 failed | 21 failed as expected
test cases: 174 | 123 passed | 47 failed | 4 failed as expected
assertions: 910 | 793 passed | 96 failed | 21 failed as expected

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesspanner>
<testsuite name="<exe-name>" errors="15" failures="82" tests="847" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="15" failures="82" tests="911" 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">
@ -512,7 +512,28 @@ 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 &amp; 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}"/>
<testcase classname="<exe-name>.global" name="StringRef/From sub-string" time="{duration}"/>
<testcase classname="<exe-name>.global" name="StringRef/Substrings/zero-based substring" time="{duration}"/>
<testcase classname="<exe-name>.global" name="StringRef/Substrings/c_str() causes copy" time="{duration}"/>
<testcase classname="<exe-name>.global" name="StringRef/Substrings/non-zero-based substring" time="{duration}"/>
<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="Strings can be rendered with colour" time="{duration}">
<system-out>
hello

View File

@ -6358,6 +6358,55 @@ 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>
@ -6393,6 +6442,571 @@ 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"
</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"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Section name="concat &amp; 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"
</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"
</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>
{?} == {?}
</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"
</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"
</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" >
<Original>
empty.empty()
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
empty.size() == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.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 string literal" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
s.empty() == false
</Original>
<Expanded>
false == false
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
s.size() == 5
</Original>
<Expanded>
5 == 5
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isSubstring( s ) == false
</Original>
<Expanded>
false == false
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
std::strcmp( rawChars, "hello" ) == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Section name="c_str() does not cause copy" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isOwned( s ) == false
</Original>
<Expanded>
false == false
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
s.c_str() == rawChars
</Original>
<Expanded>
"hello" == "hello"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isOwned( s ) == false
</Original>
<Expanded>
false == false
</Expanded>
</Expression>
<OverallResults successes="3" failures="0" expectedFailures="0"/>
</Section>
<OverallResults successes="7" failures="0" expectedFailures="0"/>
</Section>
<Section name="From sub-string" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
original == "original"
</Original>
<Expanded>
{?} == "original"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isSubstring( original )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isOwned( original ) == false
</Original>
<Expanded>
false == false
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isSubstring( original ) == false
</Original>
<Expanded>
false == false
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isOwned( original )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResults successes="5" failures="0" expectedFailures="0"/>
</Section>
<Section name="Substrings" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Section name="zero-based substring" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
ss.empty() == false
</Original>
<Expanded>
false == false
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
ss.size() == 5
</Original>
<Expanded>
5 == 5
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
std::strcmp( ss.c_str(), "hello" ) == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
ss == "hello"
</Original>
<Expanded>
{?} == "hello"
</Expanded>
</Expression>
<OverallResults successes="4" failures="0" expectedFailures="0"/>
</Section>
<OverallResults successes="4" failures="0" expectedFailures="0"/>
</Section>
<Section name="Substrings" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Section name="c_str() causes copy" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isSubstring( ss )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isOwned( ss ) == false
</Original>
<Expanded>
false == false
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
rawChars == data( s )
</Original>
<Expanded>
"hello world!" == "hello world!"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
ss.c_str() != rawChars
</Original>
<Expanded>
"hello" != "hello world!"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isSubstring( ss ) == false
</Original>
<Expanded>
false == false
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
isOwned( ss )
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
data( ss ) != data( s )
</Original>
<Expanded>
"hello" != "hello world!"
</Expanded>
</Expression>
<OverallResults successes="7" failures="0" expectedFailures="0"/>
</Section>
<OverallResults successes="7" failures="0" expectedFailures="0"/>
</Section>
<Section name="Substrings" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Section name="non-zero-based substring" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
ss.size() == 6
</Original>
<Expanded>
6 == 6
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
std::strcmp( ss.c_str(), "world!" ) == 0
</Original>
<Expanded>
0 == 0
</Expanded>
</Expression>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section>
<Section name="Substrings" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Section name="Pointer values of full refs should match" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
s.c_str() == s2.c_str()
</Original>
<Expanded>
"hello world!" == "hello world!"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Section name="Substrings" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Section name="Pointer values of substring refs should not match" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
s.c_str() != ss.c_str()
</Original>
<Expanded>
"hello world!" != "hello"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Section name="Comparisons" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
StringRef("hello") == StringRef("hello")
</Original>
<Expanded>
{?} == {?}
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
StringRef("hello") != StringRef("cello")
</Original>
<Expanded>
{?} != {?}
</Expanded>
</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"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/StringRef.tests.cpp" >
<Original>
str == "hot potato"
</Original>
<Expanded>
{?} == "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"
</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>
<OverallResult success="true"/>
</TestCase>
<TestCase name="Strings can be rendered with colour" tags="[.][.colour][hide]" filename="projects/<exe-name>/TestMain.cpp" >
<OverallResult success="true">
<StdOut>
@ -9166,7 +9780,7 @@ spanner <OverallResult success="true"/>
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="729" failures="97" expectedFailures="21"/>
<OverallResults successes="793" failures="97" expectedFailures="21"/>
</Group>
<OverallResults successes="729" failures="96" expectedFailures="21"/>
<OverallResults successes="793" failures="96" expectedFailures="21"/>
</Catch>