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

summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-05-10 07:22:11 +0200
committerMartin Hořeňovský2020-05-10 07:22:11 +0200
commit895d0a06960d9f48190dde7c7aa4a56d614946fc (patch)
tree47f966785fdfb5e29bef60fb215e9fc78f184ec7 /tests
parent094d840efe51bf1b06679d9c281e7e1513db2c81 (diff)
downloadcatch3-895d0a06960d9f48190dde7c7aa4a56d614946fc.tar.gz
Small improvements for StringRef
* `operator[]` is constexpr * `operator<<` and `operator+=` are hidden friends
Diffstat (limited to 'tests')
-rw-r--r--tests/SelfTest/Baselines/compact.sw.approved.txt1
-rw-r--r--tests/SelfTest/Baselines/console.std.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/console.sw.approved.txt6
-rw-r--r--tests/SelfTest/Baselines/junit.sw.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/tap.sw.approved.txt4
-rw-r--r--tests/SelfTest/Baselines/xml.sw.approved.txt6
-rw-r--r--tests/SelfTest/IntrospectiveTests/String.tests.cpp3
7 files changed, 15 insertions, 9 deletions
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt
index dc97d4d6..4d2fcbe2 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -1298,6 +1298,7 @@ String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() == ab
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() != stringref.end()'
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.substr(10, 0).empty()'
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.substr(2, 1).data() == abc + 2'
+String.tests.cpp:<line number>: passed: with 1 message: 'stringref[1] == 'b''
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.size() == 2'
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.data() == abc'
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.begin() != shortened.end()'
diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt
index c5aca7e9..f92173e5 100644
--- a/tests/SelfTest/Baselines/console.std.approved.txt
+++ b/tests/SelfTest/Baselines/console.std.approved.txt
@@ -1381,5 +1381,5 @@ due to unexpected exception with message:
===============================================================================
test cases: 334 | 260 passed | 70 failed | 4 failed as expected
-assertions: 1895 | 1743 passed | 131 failed | 21 failed as expected
+assertions: 1896 | 1744 passed | 131 failed | 21 failed as expected
diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt
index efdfab53..4123232c 100644
--- a/tests/SelfTest/Baselines/console.sw.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.approved.txt
@@ -9494,6 +9494,10 @@ with message:
String.tests.cpp:<line number>: PASSED:
with message:
+ stringref[1] == 'b'
+
+String.tests.cpp:<line number>: PASSED:
+with message:
shortened.size() == 2
String.tests.cpp:<line number>: PASSED:
@@ -14789,5 +14793,5 @@ Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 334 | 244 passed | 86 failed | 4 failed as expected
-assertions: 1912 | 1743 passed | 148 failed | 21 failed as expected
+assertions: 1913 | 1744 passed | 148 failed | 21 failed as expected
diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt
index 4ae272ba..9c4dd7cb 100644
--- a/tests/SelfTest/Baselines/junit.sw.approved.txt
+++ b/tests/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="1913" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="132" tests="1914" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
<property name="random-seed" value="1"/>
diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt
index d31e82ff..b28c70d4 100644
--- a/tests/SelfTest/Baselines/tap.sw.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.approved.txt
@@ -2510,6 +2510,8 @@ ok {test-number} - with 1 message: 'stringref.substr(10, 0).empty()'
# StringRef at compilation time
ok {test-number} - with 1 message: 'stringref.substr(2, 1).data() == abc + 2'
# StringRef at compilation time
+ok {test-number} - with 1 message: 'stringref[1] == 'b''
+# StringRef at compilation time
ok {test-number} - with 1 message: 'shortened.size() == 2'
# StringRef at compilation time
ok {test-number} - with 1 message: 'shortened.data() == abc'
@@ -3816,5 +3818,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
-1..1904
+1..1905
diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt
index 340e1931..10d7f304 100644
--- a/tests/SelfTest/Baselines/xml.sw.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.approved.txt
@@ -11728,7 +11728,7 @@ Message from section two
</TestCase>
<TestCase name="StringRef at compilation time" tags="[constexpr][StringRef][Strings]" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<Section name="Simple constructors" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" >
- <OverallResults successes="14" failures="0" expectedFailures="0"/>
+ <OverallResults successes="15" failures="0" expectedFailures="0"/>
</Section>
<Section name="UDL construction" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" >
<OverallResults successes="6" failures="0" expectedFailures="0"/>
@@ -17756,7 +17756,7 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="1743" failures="149" expectedFailures="21"/>
+ <OverallResults successes="1744" failures="149" expectedFailures="21"/>
</Group>
- <OverallResults successes="1743" failures="148" expectedFailures="21"/>
+ <OverallResults successes="1744" failures="148" expectedFailures="21"/>
</Catch>
diff --git a/tests/SelfTest/IntrospectiveTests/String.tests.cpp b/tests/SelfTest/IntrospectiveTests/String.tests.cpp
index ae1cc817..e616801c 100644
--- a/tests/SelfTest/IntrospectiveTests/String.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/String.tests.cpp
@@ -126,8 +126,6 @@ TEST_CASE( "StringRef", "[Strings][StringRef]" ) {
}
TEST_CASE("StringRef at compilation time", "[Strings][StringRef][constexpr]") {
- //TODO:
- // * substr
using Catch::StringRef;
SECTION("Simple constructors") {
constexpr StringRef empty{};
@@ -144,6 +142,7 @@ TEST_CASE("StringRef at compilation time", "[Strings][StringRef][constexpr]") {
STATIC_REQUIRE(stringref.begin() != stringref.end());
STATIC_REQUIRE(stringref.substr(10, 0).empty());
STATIC_REQUIRE(stringref.substr(2, 1).data() == abc + 2);
+ STATIC_REQUIRE(stringref[1] == 'b');
constexpr StringRef shortened(abc, 2);