Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-10-21 17:44:11 +0200
committerMartin Hořeňovský2019-10-25 13:57:52 +0200
commit50cc14c94c972fc743afca92b22ad7bdc63c429a (patch)
tree6654c82835e7784076b2ecd7b90d374968b5ac26 /projects
parent87b745da6625b7469e61de5910978a097caf8b74 (diff)
downloadcatch3-50cc14c94c972fc743afca92b22ad7bdc63c429a.tar.gz
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`.
Diffstat (limited to 'projects')
-rw-r--r--projects/SelfTest/Baselines/compact.sw.approved.txt44
-rw-r--r--projects/SelfTest/Baselines/console.std.approved.txt4
-rw-r--r--projects/SelfTest/Baselines/console.sw.approved.txt186
-rw-r--r--projects/SelfTest/Baselines/junit.sw.approved.txt12
-rw-r--r--projects/SelfTest/Baselines/xml.sw.approved.txt213
-rw-r--r--projects/SelfTest/IntrospectiveTests/String.tests.cpp115
6 files changed, 271 insertions, 303 deletions
diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt
index 311183bc..4090d70c 100644
--- a/projects/SelfTest/Baselines/compact.sw.approved.txt
+++ b/projects/SelfTest/Baselines/compact.sw.approved.txt
@@ -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
diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt
index fd405a84..f6f43449 100644
--- a/projects/SelfTest/Baselines/console.std.approved.txt
+++ b/projects/SelfTest/Baselines/console.std.approved.txt
@@ -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
diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt
index f234f882..0e7f7162 100644
--- a/projects/SelfTest/Baselines/console.sw.approved.txt
+++ b/projects/SelfTest/Baselines/console.sw.approved.txt
@@ -7996,6 +7996,11 @@ 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:
0 == 0
@@ -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
@@ -8106,133 +8097,94 @@ with expansion:
-------------------------------------------------------------------------------
StringRef
Substrings
- c_str() causes copy
+ non-zero-based substring
-------------------------------------------------------------------------------
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 )
+ REQUIRE( ss.size() == 6 )
with expansion:
- "hello" != "hello world!"
+ 6 == 6
String.tests.cpp:<line number>: PASSED:
- REQUIRE( isOwned( ss ) )
+ REQUIRE( std::strcmp( ss.c_str(), "world!" ) == 0 )
with expansion:
- true
+ 0 == 0
-------------------------------------------------------------------------------
StringRef
Substrings
- c_str() causes copy
- Self-assignment after substring
+ Pointer values of full refs should match
-------------------------------------------------------------------------------
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() )
+ REQUIRE( s.data() == s2.data() )
with expansion:
"hello world!" == "hello world!"
-------------------------------------------------------------------------------
StringRef
Substrings
- non-zero-based substring
+ Pointer values of substring refs should also match
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
- REQUIRE( ss.size() == 6 )
+ REQUIRE( s.data() == ss.data() )
with expansion:
- 6 == 6
-
-String.tests.cpp:<line number>: PASSED:
- REQUIRE( std::strcmp( ss.c_str(), "world!" ) == 0 )
-with expansion:
- 0 == 0
+ "hello world!" == "hello world!"
-------------------------------------------------------------------------------
StringRef
Substrings
- Pointer values of full refs should match
+ Past the end substring
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
- REQUIRE( s.c_str() == s2.c_str() )
+ REQUIRE( s.substr(s.size() + 1, 123).empty() )
with expansion:
- "hello world!" == "hello world!"
+ true
-------------------------------------------------------------------------------
StringRef
Substrings
- Pointer values of substring refs should not match
+ Substring off the end are trimmed
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
- REQUIRE( s.c_str() != ss.c_str() )
+ REQUIRE( std::strcmp(ss.c_str(), "world!") == 0 )
with expansion:
- "hello world!" != "hello"
+ 0 == 0
-------------------------------------------------------------------------------
StringRef
- Substrings
- Past the end substring
+ Comparisons are deep
-------------------------------------------------------------------------------
String.tests.cpp:<line number>
...............................................................................
String.tests.cpp:<line number>: PASSED:
- REQUIRE( s.substr(s.size() + 1, 123).empty() )
+ CHECK( buffer1 != buffer2 )
with expansion:
- true
-
--------------------------------------------------------------------------------
-StringRef
- Comparisons
--------------------------------------------------------------------------------
-String.tests.cpp:<line number>
-...............................................................................
+ "Hello" != "Hello"
String.tests.cpp:<line number>: PASSED:
- REQUIRE( StringRef("hello") == StringRef("hello") )
+ REQUIRE( left == right )
with expansion:
- hello == hello
+ Hello == Hello
String.tests.cpp:<line number>: PASSED:
- REQUIRE( StringRef("hello") != StringRef("cello") )
+ REQUIRE( left != left.substr(0, 3) )
with expansion:
- hello != cello
+ Hello != Hel
-------------------------------------------------------------------------------
StringRef
@@ -8325,6 +8277,64 @@ 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
-------------------------------------------------------------------------------
ToStringChrono.tests.cpp:<line number>
@@ -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
diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt
index bfacb033..61b364f3 100644
--- a/projects/SelfTest/Baselines/junit.sw.approved.txt
+++ b/projects/SelfTest/Baselines/junit.sw.approved.txt
@@ -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&lt;system_clock>" time="{duration}"/>
diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt
index 6193dfb3..4b67b803 100644
--- a/projects/SelfTest/Baselines/xml.sw.approved.txt
+++ b/projects/SelfTest/Baselines/xml.sw.approved.txt
@@ -9848,13 +9848,21 @@ Message from section two
</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
</Original>
<Expanded>
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
@@ -9992,79 +9997,6 @@ Message from section two
<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" >
<Original>
@@ -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!"