mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Add test for past-the-end substr on StringRef
This commit is contained in:
parent
9f4c4777a5
commit
dab0296b64
@ -1031,6 +1031,7 @@ 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: 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() == 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.c_str() != ss.c_str() for: "hello world!" != "hello"
|
||||||
|
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("hello") for: hello == hello
|
||||||
String.tests.cpp:<line number>: passed: StringRef("hello") != StringRef("cello") for: hello != cello
|
String.tests.cpp:<line number>: passed: StringRef("hello") != StringRef("cello") for: hello != cello
|
||||||
String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
|
String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
|
||||||
|
@ -1381,5 +1381,5 @@ due to unexpected exception with message:
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 300 | 226 passed | 70 failed | 4 failed as expected
|
test cases: 300 | 226 passed | 70 failed | 4 failed as expected
|
||||||
assertions: 1557 | 1405 passed | 131 failed | 21 failed as expected
|
assertions: 1558 | 1406 passed | 131 failed | 21 failed as expected
|
||||||
|
|
||||||
|
@ -7712,6 +7712,19 @@ String.tests.cpp:<line number>: PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
"hello world!" != "hello"
|
"hello world!" != "hello"
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
StringRef
|
||||||
|
Substrings
|
||||||
|
Past the end substring
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
String.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
String.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( s.substr(s.size() + 1, 123).empty() )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
StringRef
|
StringRef
|
||||||
Comparisons
|
Comparisons
|
||||||
@ -12444,5 +12457,5 @@ Misc.tests.cpp:<line number>: PASSED:
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 300 | 210 passed | 86 failed | 4 failed as expected
|
test cases: 300 | 210 passed | 86 failed | 4 failed as expected
|
||||||
assertions: 1574 | 1405 passed | 148 failed | 21 failed as expected
|
assertions: 1575 | 1406 passed | 148 failed | 21 failed as expected
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<testsuitesloose text artifact
|
<testsuitesloose text artifact
|
||||||
>
|
>
|
||||||
<testsuite name="<exe-name>" errors="17" failures="132" tests="1575" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
<testsuite name="<exe-name>" errors="17" failures="132" tests="1576" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
|
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
|
||||||
<property name="random-seed" value="1"/>
|
<property name="random-seed" value="1"/>
|
||||||
@ -722,6 +722,7 @@ Matchers.tests.cpp:<line number>
|
|||||||
<testcase classname="<exe-name>.global" name="StringRef/Substrings/non-zero-based 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 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 not 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/Comparisons" 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/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/explicitly constructed" time="{duration}"/>
|
||||||
|
@ -9516,6 +9516,20 @@ Message from section two
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
|
<Section name="Substrings" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||||
|
<Section name="Past the end substring" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
s.substr(s.size() + 1, 123).empty()
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</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>/IntrospectiveTests/String.tests.cpp" >
|
<Section name="Comparisons" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
@ -14812,7 +14826,7 @@ loose text artifact
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="1405" failures="149" expectedFailures="21"/>
|
<OverallResults successes="1406" failures="149" expectedFailures="21"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="1405" failures="148" expectedFailures="21"/>
|
<OverallResults successes="1406" failures="148" expectedFailures="21"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
@ -111,6 +111,10 @@ TEST_CASE( "StringRef", "[Strings][StringRef]" ) {
|
|||||||
SECTION( "Pointer values of substring refs should not match" ) {
|
SECTION( "Pointer values of substring refs should not match" ) {
|
||||||
REQUIRE( s.c_str() != ss.c_str() );
|
REQUIRE( s.c_str() != ss.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("Past the end substring") {
|
||||||
|
REQUIRE(s.substr(s.size() + 1, 123).empty());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION( "Comparisons" ) {
|
SECTION( "Comparisons" ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user