mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
Rework StringRef interface and internals
Now it no longer tries to be this weird hybrid between an owning and non-owning reference, and is only ever non-owning. This is also reflected in its interface, for example `StringRef::isNullTerminated` is now public, and `StringRef::c_str()` has the precondition that it is true. Overview of the changes: * The `StringRef::m_data` member has been completely removed, as it had no more uses. * `StringRef::isSubstring()` has been made public and renamed to `StringRef::isNullTerminated()`, so that the name reflects what the method actually does. * `StringRef::currentData()` has been renamed to `StringRef::data()`, to be in line with common C++ containers and container-alikes. * `StringRef::c_str()` will no longer silently make copies. It instead has a precondition that `isNullTerminated()` is true. * If the user needs a null-terminated string, they should use the `std::string` conversion operator and call `c_str()` on the resulting `std::string`. * Some small optimizations in various places. * Basic functionality is now `constexpr`.
This commit is contained in:
@@ -1095,37 +1095,32 @@ Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith("sub
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive)
|
||||
String.tests.cpp:<line number>: passed: empty.empty() for: true
|
||||
String.tests.cpp:<line number>: passed: empty.size() == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: empty.isNullTerminated() for: true
|
||||
String.tests.cpp:<line number>: passed: std::strcmp( empty.c_str(), "" ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: s.empty() == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: s.size() == 5 for: 5 == 5
|
||||
String.tests.cpp:<line number>: passed: isSubstring( s ) == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: s.isNullTerminated() for: true
|
||||
String.tests.cpp:<line number>: passed: std::strcmp( rawChars, "hello" ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: isOwned( s ) == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: s.c_str()
|
||||
String.tests.cpp:<line number>: passed: s.c_str() == rawChars for: "hello" == "hello"
|
||||
String.tests.cpp:<line number>: passed: isOwned( s ) == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: s.data() == rawChars for: "hello" == "hello"
|
||||
String.tests.cpp:<line number>: passed: original == "original"
|
||||
String.tests.cpp:<line number>: passed: isSubstring( original ) for: true
|
||||
String.tests.cpp:<line number>: passed: isOwned( original ) == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: isOwned( original ) for: true
|
||||
String.tests.cpp:<line number>: passed: !(original.isNullTerminated()) for: !false
|
||||
String.tests.cpp:<line number>: passed: original.c_str()
|
||||
String.tests.cpp:<line number>: passed: original.data()
|
||||
String.tests.cpp:<line number>: passed: ss.empty() == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: ss.size() == 5 for: 5 == 5
|
||||
String.tests.cpp:<line number>: passed: std::strcmp( ss.c_str(), "hello" ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: std::strncmp( ss.data(), "hello", 5 ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: ss == "hello" for: hello == "hello"
|
||||
String.tests.cpp:<line number>: passed: isSubstring( ss ) for: true
|
||||
String.tests.cpp:<line number>: passed: isOwned( ss ) == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: rawChars == s.currentData() for: "hello world!" == "hello world!"
|
||||
String.tests.cpp:<line number>: passed: ss.c_str() != rawChars for: "hello" != "hello world!"
|
||||
String.tests.cpp:<line number>: passed: isOwned( ss ) for: true
|
||||
String.tests.cpp:<line number>: passed: isOwned(ss) == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: ss == "hello" for: hello == "hello"
|
||||
String.tests.cpp:<line number>: passed: rawChars == ss.currentData() for: "hello world!" == "hello world!"
|
||||
String.tests.cpp:<line number>: passed: ss.size() == 6 for: 6 == 6
|
||||
String.tests.cpp:<line number>: passed: std::strcmp( ss.c_str(), "world!" ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: s.c_str() == s2.c_str() for: "hello world!" == "hello world!"
|
||||
String.tests.cpp:<line number>: passed: s.c_str() != ss.c_str() for: "hello world!" != "hello"
|
||||
String.tests.cpp:<line number>: passed: s.data() == s2.data() for: "hello world!" == "hello world!"
|
||||
String.tests.cpp:<line number>: passed: s.data() == ss.data() for: "hello world!" == "hello world!"
|
||||
String.tests.cpp:<line number>: passed: s.substr(s.size() + 1, 123).empty() for: true
|
||||
String.tests.cpp:<line number>: passed: StringRef("hello") == StringRef("hello") for: hello == hello
|
||||
String.tests.cpp:<line number>: passed: StringRef("hello") != StringRef("cello") for: hello != cello
|
||||
String.tests.cpp:<line number>: passed: std::strcmp(ss.c_str(), "world!") == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: buffer1 != buffer2 for: "Hello" != "Hello"
|
||||
String.tests.cpp:<line number>: passed: left == right for: Hello == Hello
|
||||
String.tests.cpp:<line number>: passed: left != left.substr(0, 3) for: Hello != Hel
|
||||
String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
|
||||
String.tests.cpp:<line number>: passed: sr.size() == stdStr.size() for: 17 == 17
|
||||
String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
|
||||
@@ -1136,6 +1131,17 @@ String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringre
|
||||
String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11
|
||||
String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringref" == "a stringref"
|
||||
String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'StringRef{}.size() == 0'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'StringRef{ "abc", 3 }.size() == 3'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'StringRef{ "abc", 3 }.isNullTerminated()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'StringRef{ "abc", 2 }.size() == 2'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: '!(StringRef{ "abc", 2 }.isNullTerminated())'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: '!(sr1.empty())'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr1.size() == 3'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr1.isNullTerminated()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr2.empty()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr2.size() == 0'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr2.isNullTerminated()'
|
||||
ToStringChrono.tests.cpp:<line number>: passed: minute == seconds for: 1 m == 60 s
|
||||
ToStringChrono.tests.cpp:<line number>: passed: hour != seconds for: 1 h != 60 s
|
||||
ToStringChrono.tests.cpp:<line number>: passed: micro != milli for: 1 us != 1 ms
|
||||
|
@@ -1380,6 +1380,6 @@ due to unexpected exception with message:
|
||||
Why would you throw a std::string?
|
||||
|
||||
===============================================================================
|
||||
test cases: 304 | 230 passed | 70 failed | 4 failed as expected
|
||||
assertions: 1621 | 1469 passed | 131 failed | 21 failed as expected
|
||||
test cases: 305 | 231 passed | 70 failed | 4 failed as expected
|
||||
assertions: 1627 | 1475 passed | 131 failed | 21 failed as expected
|
||||
|
||||
|
@@ -7995,6 +7995,11 @@ String.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( empty.isNullTerminated() )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strcmp( empty.c_str(), "" ) == 0 )
|
||||
with expansion:
|
||||
@@ -8018,27 +8023,17 @@ with expansion:
|
||||
5 == 5
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( isSubstring( s ) == false )
|
||||
REQUIRE( s.isNullTerminated() )
|
||||
with expansion:
|
||||
false == false
|
||||
true
|
||||
|
||||
String.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
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( isOwned( s ) == false )
|
||||
with expansion:
|
||||
false == false
|
||||
REQUIRE_NOTHROW( s.c_str() )
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.c_str() == rawChars )
|
||||
@@ -8046,9 +8041,9 @@ with expansion:
|
||||
"hello" == "hello"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( isOwned( s ) == false )
|
||||
REQUIRE( s.data() == rawChars )
|
||||
with expansion:
|
||||
false == false
|
||||
"hello" == "hello"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
@@ -8061,19 +8056,15 @@ String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( original == "original" )
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( isSubstring( original ) )
|
||||
REQUIRE_FALSE( original.isNullTerminated() )
|
||||
with expansion:
|
||||
true
|
||||
!false
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( isOwned( original ) == false )
|
||||
with expansion:
|
||||
false == false
|
||||
REQUIRE_THROWS( original.c_str() )
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( isOwned( original ) )
|
||||
with expansion:
|
||||
true
|
||||
REQUIRE_NOTHROW( original.data() )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
@@ -8094,7 +8085,7 @@ with expansion:
|
||||
5 == 5
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strcmp( ss.c_str(), "hello" ) == 0 )
|
||||
REQUIRE( std::strncmp( ss.data(), "hello", 5 ) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
@@ -8103,63 +8094,6 @@ String.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
hello == "hello"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
c_str() causes copy
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( isSubstring( ss ) )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( isOwned( ss ) == false )
|
||||
with expansion:
|
||||
false == false
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( rawChars == s.currentData() )
|
||||
with expansion:
|
||||
"hello world!" == "hello world!"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( ss.c_str() != rawChars )
|
||||
with expansion:
|
||||
"hello" != "hello world!"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( isOwned( ss ) )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
c_str() causes copy
|
||||
Self-assignment after substring
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( isOwned(ss) == false )
|
||||
with expansion:
|
||||
false == false
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( ss == "hello" )
|
||||
with expansion:
|
||||
hello == "hello"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( rawChars == ss.currentData() )
|
||||
with expansion:
|
||||
"hello world!" == "hello world!"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
@@ -8187,22 +8121,22 @@ String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.c_str() == s2.c_str() )
|
||||
REQUIRE( s.data() == s2.data() )
|
||||
with expansion:
|
||||
"hello world!" == "hello world!"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
Pointer values of substring refs should not match
|
||||
Pointer values of substring refs should also match
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.c_str() != ss.c_str() )
|
||||
REQUIRE( s.data() == ss.data() )
|
||||
with expansion:
|
||||
"hello world!" != "hello"
|
||||
"hello world!" == "hello world!"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
@@ -8219,20 +8153,38 @@ with expansion:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Comparisons
|
||||
Substrings
|
||||
Substring off the end are trimmed
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( StringRef("hello") == StringRef("hello") )
|
||||
REQUIRE( std::strcmp(ss.c_str(), "world!") == 0 )
|
||||
with expansion:
|
||||
hello == hello
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Comparisons are deep
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( StringRef("hello") != StringRef("cello") )
|
||||
CHECK( buffer1 != buffer2 )
|
||||
with expansion:
|
||||
hello != cello
|
||||
"Hello" != "Hello"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( left == right )
|
||||
with expansion:
|
||||
Hello == Hello
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( left != left.substr(0, 3) )
|
||||
with expansion:
|
||||
Hello != Hel
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
@@ -8324,6 +8276,64 @@ String.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
11 == 11
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef at compilation time
|
||||
Simple constructors
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
StringRef{}.size() == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
StringRef{ "abc", 3 }.size() == 3
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
StringRef{ "abc", 3 }.isNullTerminated()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
StringRef{ "abc", 2 }.size() == 2
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
!(StringRef{ "abc", 2 }.isNullTerminated())
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef at compilation time
|
||||
UDL construction
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
!(sr1.empty())
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr1.size() == 3
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr1.isNullTerminated()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr2.empty()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr2.size() == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr2.isNullTerminated()
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Stringifying std::chrono::duration helpers
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -12956,6 +12966,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 304 | 214 passed | 86 failed | 4 failed as expected
|
||||
assertions: 1638 | 1469 passed | 148 failed | 21 failed as expected
|
||||
test cases: 305 | 215 passed | 86 failed | 4 failed as expected
|
||||
assertions: 1644 | 1475 passed | 148 failed | 21 failed as expected
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="17" failures="132" tests="1639" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="132" tests="1645" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<properties>
|
||||
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
|
||||
<property name="random-seed" value="1"/>
|
||||
@@ -726,21 +726,21 @@ Matchers.tests.cpp:<line number>
|
||||
<testcase classname="<exe-name>.global" name="String matchers" 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/c_str() causes copy/Self-assignment after substring" 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/Substrings/Pointer values of substring refs should also match" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/Substrings/Past the end substring" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/Comparisons" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/Substrings/Substring off the end are trimmed" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/Comparisons are deep" 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}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/to std::string/explicitly constructed" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef/to std::string/assigned" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef at compilation time/Simple constructors" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="StringRef at compilation time/UDL construction" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Stringifying std::chrono::duration helpers" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Stringifying std::chrono::duration with weird ratios" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Stringifying std::chrono::time_point<system_clock>" time="{duration}"/>
|
||||
|
@@ -9846,6 +9846,14 @@ Message from section two
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
empty.isNullTerminated()
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
std::strcmp( empty.c_str(), "" ) == 0
|
||||
@@ -9854,7 +9862,7 @@ Message from section two
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="From string literal" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
@@ -9875,10 +9883,10 @@ Message from section two
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
isSubstring( s ) == false
|
||||
s.isNullTerminated()
|
||||
</Original>
|
||||
<Expanded>
|
||||
false == false
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
@@ -9889,33 +9897,30 @@ Message from section two
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="c_str() does not cause copy" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
isOwned( s ) == false
|
||||
</Original>
|
||||
<Expanded>
|
||||
false == false
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
s.c_str() == rawChars
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello" == "hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
isOwned( s ) == false
|
||||
</Original>
|
||||
<Expanded>
|
||||
false == false
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
s.c_str()
|
||||
</Original>
|
||||
<Expanded>
|
||||
s.c_str()
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
s.c_str() == rawChars
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello" == "hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
s.data() == rawChars
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello" == "hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="7" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="From sub-string" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
@@ -9927,28 +9932,28 @@ Message from section two
|
||||
original == "original"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
isSubstring( original )
|
||||
!(original.isNullTerminated())
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
!false
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THROWS" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
isOwned( original ) == false
|
||||
original.c_str()
|
||||
</Original>
|
||||
<Expanded>
|
||||
false == false
|
||||
original.c_str()
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
isOwned( original )
|
||||
original.data()
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
original.data()
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||
@@ -9973,7 +9978,7 @@ Message from section two
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
std::strcmp( ss.c_str(), "hello" ) == 0
|
||||
std::strncmp( ss.data(), "hello", 5 ) == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
@@ -9991,79 +9996,6 @@ Message from section two
|
||||
</Section>
|
||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="Substrings" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="c_str() causes copy" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
isSubstring( ss )
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
isOwned( ss ) == false
|
||||
</Original>
|
||||
<Expanded>
|
||||
false == false
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
rawChars == s.currentData()
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello world!" == "hello world!"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
ss.c_str() != rawChars
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello" != "hello world!"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
isOwned( ss )
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="Self-assignment after substring" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
isOwned(ss) == false
|
||||
</Original>
|
||||
<Expanded>
|
||||
false == false
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
ss == "hello"
|
||||
</Original>
|
||||
<Expanded>
|
||||
hello == "hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
rawChars == ss.currentData()
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello world!" == "hello world!"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="8" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="8" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="Substrings" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="non-zero-based substring" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
@@ -10090,7 +10022,7 @@ Message from section two
|
||||
<Section name="Pointer values of full refs should match" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
s.c_str() == s2.c_str()
|
||||
s.data() == s2.data()
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello world!" == "hello world!"
|
||||
@@ -10101,13 +10033,13 @@ Message from section two
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="Substrings" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="Pointer values of substring refs should not match" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="Pointer values of substring refs should also match" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
s.c_str() != ss.c_str()
|
||||
s.data() == ss.data()
|
||||
</Original>
|
||||
<Expanded>
|
||||
"hello world!" != "hello"
|
||||
"hello world!" == "hello world!"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
@@ -10128,24 +10060,46 @@ Message from section two
|
||||
</Section>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="Comparisons" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="Substrings" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="Substring off the end are trimmed" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
std::strcmp(ss.c_str(), "world!") == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="Comparisons are deep" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
StringRef("hello") == StringRef("hello")
|
||||
buffer1 != buffer2
|
||||
</Original>
|
||||
<Expanded>
|
||||
hello == hello
|
||||
"Hello" != "Hello"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
StringRef("hello") != StringRef("cello")
|
||||
left == right
|
||||
</Original>
|
||||
<Expanded>
|
||||
hello != cello
|
||||
Hello == Hello
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Original>
|
||||
left != left.substr(0, 3)
|
||||
</Original>
|
||||
<Expanded>
|
||||
Hello != Hel
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="from std::string" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="implicitly constructed" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
@@ -10259,6 +10213,15 @@ Message from section two
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="StringRef at compilation time" tags="[StringRef][Strings][constexpr]" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<Section name="Simple constructors" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<OverallResults successes="5" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="UDL construction" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||
<OverallResults successes="6" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Stringifying std::chrono::duration helpers" tags="[chrono][toString]" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
|
||||
<Original>
|
||||
@@ -15427,7 +15390,7 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="1469" failures="149" expectedFailures="21"/>
|
||||
<OverallResults successes="1475" failures="149" expectedFailures="21"/>
|
||||
</Group>
|
||||
<OverallResults successes="1469" failures="148" expectedFailures="21"/>
|
||||
<OverallResults successes="1475" failures="148" expectedFailures="21"/>
|
||||
</Catch>
|
||||
|
Reference in New Issue
Block a user