Update outdated tests for stringifying characters

Previously the tests relied purely on output changes in approvals.
Now the stringification output is checked directly as part of the
unit tests.
This commit is contained in:
Martin Hořeňovský 2024-03-01 15:09:06 +01:00
parent fb51116d5b
commit c3fd4eb17e
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
12 changed files with 153 additions and 292 deletions

View File

@ -350,20 +350,16 @@ Details.tests.cpp:<line number>: passed: lt( "a", "b" ) for: true
Details.tests.cpp:<line number>: passed: lt( "a", "B" ) for: true
Details.tests.cpp:<line number>: passed: lt( "A", "b" ) for: true
Details.tests.cpp:<line number>: passed: lt( "A", "B" ) for: true
ToStringGeneral.tests.cpp:<line number>: passed: tab == '\t' for: '\t' == '\t'
ToStringGeneral.tests.cpp:<line number>: passed: newline == '\n' for: '\n' == '\n'
ToStringGeneral.tests.cpp:<line number>: passed: carr_return == '\r' for: '\r' == '\r'
ToStringGeneral.tests.cpp:<line number>: passed: form_feed == '\f' for: '\f' == '\f'
ToStringGeneral.tests.cpp:<line number>: passed: space == ' ' for: ' ' == ' '
ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'a' == 'a'
ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'z' == 'z'
ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'A' == 'A'
ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'Z' == 'Z'
ToStringGeneral.tests.cpp:<line number>: passed: null_terminator == '\0' for: 0 == 0
ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 2 == 2
ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 3 == 3
ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 4 == 4
ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 5 == 5
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify('\t') == "'\\t'" for: "'\t'" == "'\t'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify('\n') == "'\\n'" for: "'\n'" == "'\n'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify('\r') == "'\\r'" for: "'\r'" == "'\r'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify('\f') == "'\\f'" for: "'\f'" == "'\f'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( ' ' ) == "' '" for: "' '" == "' '"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( 'A' ) == "'A'" for: "'A'" == "'A'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( 'z' ) == "'z'" for: "'z'" == "'z'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( '\0' ) == "0" for: "0" == "0"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( static_cast<char>(2) ) == "2" for: "2" == "2"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( static_cast<char>(5) ) == "5" for: "5" == "5"
Clara.tests.cpp:<line number>: passed: name.empty() for: true
Clara.tests.cpp:<line number>: passed: name == "foo" for: "foo" == "foo"
Clara.tests.cpp:<line number>: passed: !(parse_result) for: !{?}
@ -2690,6 +2686,6 @@ InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
test cases: 417 | 312 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2260 | 2079 passed | 146 failed | 35 failed as expected
assertions: 2256 | 2075 passed | 146 failed | 35 failed as expected

View File

@ -348,20 +348,16 @@ Details.tests.cpp:<line number>: passed: lt( "a", "b" ) for: true
Details.tests.cpp:<line number>: passed: lt( "a", "B" ) for: true
Details.tests.cpp:<line number>: passed: lt( "A", "b" ) for: true
Details.tests.cpp:<line number>: passed: lt( "A", "B" ) for: true
ToStringGeneral.tests.cpp:<line number>: passed: tab == '\t' for: '\t' == '\t'
ToStringGeneral.tests.cpp:<line number>: passed: newline == '\n' for: '\n' == '\n'
ToStringGeneral.tests.cpp:<line number>: passed: carr_return == '\r' for: '\r' == '\r'
ToStringGeneral.tests.cpp:<line number>: passed: form_feed == '\f' for: '\f' == '\f'
ToStringGeneral.tests.cpp:<line number>: passed: space == ' ' for: ' ' == ' '
ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'a' == 'a'
ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'z' == 'z'
ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'A' == 'A'
ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'Z' == 'Z'
ToStringGeneral.tests.cpp:<line number>: passed: null_terminator == '\0' for: 0 == 0
ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 2 == 2
ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 3 == 3
ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 4 == 4
ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 5 == 5
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify('\t') == "'\\t'" for: "'\t'" == "'\t'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify('\n') == "'\\n'" for: "'\n'" == "'\n'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify('\r') == "'\\r'" for: "'\r'" == "'\r'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify('\f') == "'\\f'" for: "'\f'" == "'\f'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( ' ' ) == "' '" for: "' '" == "' '"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( 'A' ) == "'A'" for: "'A'" == "'A'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( 'z' ) == "'z'" for: "'z'" == "'z'"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( '\0' ) == "0" for: "0" == "0"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( static_cast<char>(2) ) == "2" for: "2" == "2"
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( static_cast<char>(5) ) == "5" for: "5" == "5"
Clara.tests.cpp:<line number>: passed: name.empty() for: true
Clara.tests.cpp:<line number>: passed: name == "foo" for: "foo" == "foo"
Clara.tests.cpp:<line number>: passed: !(parse_result) for: !{?}
@ -2679,6 +2675,6 @@ InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
test cases: 417 | 312 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2260 | 2079 passed | 146 failed | 35 failed as expected
assertions: 2256 | 2075 passed | 146 failed | 35 failed as expected

View File

@ -1589,5 +1589,5 @@ due to unexpected exception with message:
===============================================================================
test cases: 417 | 326 passed | 70 failed | 7 skipped | 14 failed as expected
assertions: 2243 | 2079 passed | 129 failed | 35 failed as expected
assertions: 2239 | 2075 passed | 129 failed | 35 failed as expected

View File

@ -2904,24 +2904,24 @@ ToStringGeneral.tests.cpp:<line number>
...............................................................................
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( tab == '\t' )
CHECK( ::Catch::Detail::stringify('\t') == "'\\t'" )
with expansion:
'\t' == '\t'
"'\t'" == "'\t'"
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( newline == '\n' )
CHECK( ::Catch::Detail::stringify('\n') == "'\\n'" )
with expansion:
'\n' == '\n'
"'\n'" == "'\n'"
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( carr_return == '\r' )
CHECK( ::Catch::Detail::stringify('\r') == "'\\r'" )
with expansion:
'\r' == '\r'
"'\r'" == "'\r'"
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( form_feed == '\f' )
CHECK( ::Catch::Detail::stringify('\f') == "'\\f'" )
with expansion:
'\f' == '\f'
"'\f'" == "'\f'"
-------------------------------------------------------------------------------
Character pretty printing
@ -2931,29 +2931,19 @@ ToStringGeneral.tests.cpp:<line number>
...............................................................................
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( space == ' ' )
CHECK( ::Catch::Detail::stringify( ' ' ) == "' '" )
with expansion:
' ' == ' '
"' '" == "' '"
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == chars[i] )
CHECK( ::Catch::Detail::stringify( 'A' ) == "'A'" )
with expansion:
'a' == 'a'
"'A'" == "'A'"
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == chars[i] )
CHECK( ::Catch::Detail::stringify( 'z' ) == "'z'" )
with expansion:
'z' == 'z'
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == chars[i] )
with expansion:
'A' == 'A'
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == chars[i] )
with expansion:
'Z' == 'Z'
"'z'" == "'z'"
-------------------------------------------------------------------------------
Character pretty printing
@ -2963,29 +2953,19 @@ ToStringGeneral.tests.cpp:<line number>
...............................................................................
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( null_terminator == '\0' )
CHECK( ::Catch::Detail::stringify( '\0' ) == "0" )
with expansion:
0 == 0
"0" == "0"
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == i )
CHECK( ::Catch::Detail::stringify( static_cast<char>(2) ) == "2" )
with expansion:
2 == 2
"2" == "2"
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == i )
CHECK( ::Catch::Detail::stringify( static_cast<char>(5) ) == "5" )
with expansion:
3 == 3
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == i )
with expansion:
4 == 4
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == i )
with expansion:
5 == 5
"5" == "5"
-------------------------------------------------------------------------------
Clara::Arg supports single-arg parse the way Opt does
@ -18752,5 +18732,5 @@ Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 417 | 312 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2260 | 2079 passed | 146 failed | 35 failed as expected
assertions: 2256 | 2075 passed | 146 failed | 35 failed as expected

View File

@ -2902,24 +2902,24 @@ ToStringGeneral.tests.cpp:<line number>
...............................................................................
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( tab == '\t' )
CHECK( ::Catch::Detail::stringify('\t') == "'\\t'" )
with expansion:
'\t' == '\t'
"'\t'" == "'\t'"
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( newline == '\n' )
CHECK( ::Catch::Detail::stringify('\n') == "'\\n'" )
with expansion:
'\n' == '\n'
"'\n'" == "'\n'"
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( carr_return == '\r' )
CHECK( ::Catch::Detail::stringify('\r') == "'\\r'" )
with expansion:
'\r' == '\r'
"'\r'" == "'\r'"
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( form_feed == '\f' )
CHECK( ::Catch::Detail::stringify('\f') == "'\\f'" )
with expansion:
'\f' == '\f'
"'\f'" == "'\f'"
-------------------------------------------------------------------------------
Character pretty printing
@ -2929,29 +2929,19 @@ ToStringGeneral.tests.cpp:<line number>
...............................................................................
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( space == ' ' )
CHECK( ::Catch::Detail::stringify( ' ' ) == "' '" )
with expansion:
' ' == ' '
"' '" == "' '"
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == chars[i] )
CHECK( ::Catch::Detail::stringify( 'A' ) == "'A'" )
with expansion:
'a' == 'a'
"'A'" == "'A'"
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == chars[i] )
CHECK( ::Catch::Detail::stringify( 'z' ) == "'z'" )
with expansion:
'z' == 'z'
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == chars[i] )
with expansion:
'A' == 'A'
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == chars[i] )
with expansion:
'Z' == 'Z'
"'z'" == "'z'"
-------------------------------------------------------------------------------
Character pretty printing
@ -2961,29 +2951,19 @@ ToStringGeneral.tests.cpp:<line number>
...............................................................................
ToStringGeneral.tests.cpp:<line number>: PASSED:
CHECK( null_terminator == '\0' )
CHECK( ::Catch::Detail::stringify( '\0' ) == "0" )
with expansion:
0 == 0
"0" == "0"
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == i )
CHECK( ::Catch::Detail::stringify( static_cast<char>(2) ) == "2" )
with expansion:
2 == 2
"2" == "2"
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == i )
CHECK( ::Catch::Detail::stringify( static_cast<char>(5) ) == "5" )
with expansion:
3 == 3
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == i )
with expansion:
4 == 4
ToStringGeneral.tests.cpp:<line number>: PASSED:
REQUIRE( c == i )
with expansion:
5 == 5
"5" == "5"
-------------------------------------------------------------------------------
Clara::Arg supports single-arg parse the way Opt does
@ -18741,5 +18721,5 @@ Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 417 | 312 passed | 85 failed | 6 skipped | 14 failed as expected
assertions: 2260 | 2079 passed | 146 failed | 35 failed as expected
assertions: 2256 | 2075 passed | 146 failed | 35 failed as expected

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2272" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2268" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2272" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="129" skipped="12" tests="2268" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="&quot;*&quot; ~[!nonportable] ~[!benchmark] ~[approvals]"/>

View File

@ -697,33 +697,25 @@ ok {test-number} - lt( "A", "b" ) for: true
# CaseInsensitiveLess is case insensitive
ok {test-number} - lt( "A", "B" ) for: true
# Character pretty printing
ok {test-number} - tab == '\t' for: '\t' == '\t'
ok {test-number} - ::Catch::Detail::stringify('\t') == "'\\t'" for: "'\t'" == "'\t'"
# Character pretty printing
ok {test-number} - newline == '\n' for: '\n' == '\n'
ok {test-number} - ::Catch::Detail::stringify('\n') == "'\\n'" for: "'\n'" == "'\n'"
# Character pretty printing
ok {test-number} - carr_return == '\r' for: '\r' == '\r'
ok {test-number} - ::Catch::Detail::stringify('\r') == "'\\r'" for: "'\r'" == "'\r'"
# Character pretty printing
ok {test-number} - form_feed == '\f' for: '\f' == '\f'
ok {test-number} - ::Catch::Detail::stringify('\f') == "'\\f'" for: "'\f'" == "'\f'"
# Character pretty printing
ok {test-number} - space == ' ' for: ' ' == ' '
ok {test-number} - ::Catch::Detail::stringify( ' ' ) == "' '" for: "' '" == "' '"
# Character pretty printing
ok {test-number} - c == chars[i] for: 'a' == 'a'
ok {test-number} - ::Catch::Detail::stringify( 'A' ) == "'A'" for: "'A'" == "'A'"
# Character pretty printing
ok {test-number} - c == chars[i] for: 'z' == 'z'
ok {test-number} - ::Catch::Detail::stringify( 'z' ) == "'z'" for: "'z'" == "'z'"
# Character pretty printing
ok {test-number} - c == chars[i] for: 'A' == 'A'
ok {test-number} - ::Catch::Detail::stringify( '\0' ) == "0" for: "0" == "0"
# Character pretty printing
ok {test-number} - c == chars[i] for: 'Z' == 'Z'
ok {test-number} - ::Catch::Detail::stringify( static_cast<char>(2) ) == "2" for: "2" == "2"
# Character pretty printing
ok {test-number} - null_terminator == '\0' for: 0 == 0
# Character pretty printing
ok {test-number} - c == i for: 2 == 2
# Character pretty printing
ok {test-number} - c == i for: 3 == 3
# Character pretty printing
ok {test-number} - c == i for: 4 == 4
# Character pretty printing
ok {test-number} - c == i for: 5 == 5
ok {test-number} - ::Catch::Detail::stringify( static_cast<char>(5) ) == "5" for: "5" == "5"
# Clara::Arg supports single-arg parse the way Opt does
ok {test-number} - name.empty() for: true
# Clara::Arg supports single-arg parse the way Opt does
@ -4549,5 +4541,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2272
1..2268

View File

@ -695,33 +695,25 @@ ok {test-number} - lt( "A", "b" ) for: true
# CaseInsensitiveLess is case insensitive
ok {test-number} - lt( "A", "B" ) for: true
# Character pretty printing
ok {test-number} - tab == '\t' for: '\t' == '\t'
ok {test-number} - ::Catch::Detail::stringify('\t') == "'\\t'" for: "'\t'" == "'\t'"
# Character pretty printing
ok {test-number} - newline == '\n' for: '\n' == '\n'
ok {test-number} - ::Catch::Detail::stringify('\n') == "'\\n'" for: "'\n'" == "'\n'"
# Character pretty printing
ok {test-number} - carr_return == '\r' for: '\r' == '\r'
ok {test-number} - ::Catch::Detail::stringify('\r') == "'\\r'" for: "'\r'" == "'\r'"
# Character pretty printing
ok {test-number} - form_feed == '\f' for: '\f' == '\f'
ok {test-number} - ::Catch::Detail::stringify('\f') == "'\\f'" for: "'\f'" == "'\f'"
# Character pretty printing
ok {test-number} - space == ' ' for: ' ' == ' '
ok {test-number} - ::Catch::Detail::stringify( ' ' ) == "' '" for: "' '" == "' '"
# Character pretty printing
ok {test-number} - c == chars[i] for: 'a' == 'a'
ok {test-number} - ::Catch::Detail::stringify( 'A' ) == "'A'" for: "'A'" == "'A'"
# Character pretty printing
ok {test-number} - c == chars[i] for: 'z' == 'z'
ok {test-number} - ::Catch::Detail::stringify( 'z' ) == "'z'" for: "'z'" == "'z'"
# Character pretty printing
ok {test-number} - c == chars[i] for: 'A' == 'A'
ok {test-number} - ::Catch::Detail::stringify( '\0' ) == "0" for: "0" == "0"
# Character pretty printing
ok {test-number} - c == chars[i] for: 'Z' == 'Z'
ok {test-number} - ::Catch::Detail::stringify( static_cast<char>(2) ) == "2" for: "2" == "2"
# Character pretty printing
ok {test-number} - null_terminator == '\0' for: 0 == 0
# Character pretty printing
ok {test-number} - c == i for: 2 == 2
# Character pretty printing
ok {test-number} - c == i for: 3 == 3
# Character pretty printing
ok {test-number} - c == i for: 4 == 4
# Character pretty printing
ok {test-number} - c == i for: 5 == 5
ok {test-number} - ::Catch::Detail::stringify( static_cast<char>(5) ) == "5" for: "5" == "5"
# Clara::Arg supports single-arg parse the way Opt does
ok {test-number} - name.empty() for: true
# Clara::Arg supports single-arg parse the way Opt does
@ -4538,5 +4530,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
1..2272
1..2268

View File

@ -3142,34 +3142,34 @@ Nor would this
<Section name="Specifically escaped" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
tab == '\t'
::Catch::Detail::stringify('\t') == "'\\t'"
</Original>
<Expanded>
'\t' == '\t'
"'\t'" == "'\t'"
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
newline == '\n'
::Catch::Detail::stringify('\n') == "'\\n'"
</Original>
<Expanded>
'\n' == '\n'
"'\n'" == "'\n'"
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
carr_return == '\r'
::Catch::Detail::stringify('\r') == "'\\r'"
</Original>
<Expanded>
'\r' == '\r'
"'\r'" == "'\r'"
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
form_feed == '\f'
::Catch::Detail::stringify('\f') == "'\\f'"
</Original>
<Expanded>
'\f' == '\f'
"'\f'" == "'\f'"
</Expanded>
</Expression>
<OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/>
@ -3177,88 +3177,56 @@ Nor would this
<Section name="General chars" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
space == ' '
::Catch::Detail::stringify( ' ' ) == "' '"
</Original>
<Expanded>
' ' == ' '
"' '" == "' '"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == chars[i]
::Catch::Detail::stringify( 'A' ) == "'A'"
</Original>
<Expanded>
'a' == 'a'
"'A'" == "'A'"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == chars[i]
::Catch::Detail::stringify( 'z' ) == "'z'"
</Original>
<Expanded>
'z' == 'z'
"'z'" == "'z'"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == chars[i]
</Original>
<Expanded>
'A' == 'A'
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == chars[i]
</Original>
<Expanded>
'Z' == 'Z'
</Expanded>
</Expression>
<OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/>
<OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Low ASCII" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
null_terminator == '\0'
::Catch::Detail::stringify( '\0' ) == "0"
</Original>
<Expanded>
0 == 0
"0" == "0"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == i
::Catch::Detail::stringify( static_cast&lt;char>(2) ) == "2"
</Original>
<Expanded>
2 == 2
"2" == "2"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == i
::Catch::Detail::stringify( static_cast&lt;char>(5) ) == "5"
</Original>
<Expanded>
3 == 3
"5" == "5"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == i
</Original>
<Expanded>
4 == 4
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == i
</Original>
<Expanded>
5 == 5
</Expanded>
</Expression>
<OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/>
<OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
@ -21707,6 +21675,6 @@ b1!
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2079" failures="146" expectedFailures="35" skips="12"/>
<OverallResults successes="2075" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="312" failures="85" expectedFailures="14" skips="6"/>
</Catch2TestRun>

View File

@ -3142,34 +3142,34 @@ Nor would this
<Section name="Specifically escaped" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
tab == '\t'
::Catch::Detail::stringify('\t') == "'\\t'"
</Original>
<Expanded>
'\t' == '\t'
"'\t'" == "'\t'"
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
newline == '\n'
::Catch::Detail::stringify('\n') == "'\\n'"
</Original>
<Expanded>
'\n' == '\n'
"'\n'" == "'\n'"
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
carr_return == '\r'
::Catch::Detail::stringify('\r') == "'\\r'"
</Original>
<Expanded>
'\r' == '\r'
"'\r'" == "'\r'"
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
form_feed == '\f'
::Catch::Detail::stringify('\f') == "'\\f'"
</Original>
<Expanded>
'\f' == '\f'
"'\f'" == "'\f'"
</Expanded>
</Expression>
<OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/>
@ -3177,88 +3177,56 @@ Nor would this
<Section name="General chars" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
space == ' '
::Catch::Detail::stringify( ' ' ) == "' '"
</Original>
<Expanded>
' ' == ' '
"' '" == "' '"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == chars[i]
::Catch::Detail::stringify( 'A' ) == "'A'"
</Original>
<Expanded>
'a' == 'a'
"'A'" == "'A'"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == chars[i]
::Catch::Detail::stringify( 'z' ) == "'z'"
</Original>
<Expanded>
'z' == 'z'
"'z'" == "'z'"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == chars[i]
</Original>
<Expanded>
'A' == 'A'
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == chars[i]
</Original>
<Expanded>
'Z' == 'Z'
</Expanded>
</Expression>
<OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/>
<OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<Section name="Low ASCII" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
null_terminator == '\0'
::Catch::Detail::stringify( '\0' ) == "0"
</Original>
<Expanded>
0 == 0
"0" == "0"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == i
::Catch::Detail::stringify( static_cast&lt;char>(2) ) == "2"
</Original>
<Expanded>
2 == 2
"2" == "2"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == i
::Catch::Detail::stringify( static_cast&lt;char>(5) ) == "5"
</Original>
<Expanded>
3 == 3
"5" == "5"
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == i
</Original>
<Expanded>
4 == 4
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Original>
c == i
</Original>
<Expanded>
5 == 5
</Expanded>
</Expression>
<OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/>
<OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/>
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
@ -21706,6 +21674,6 @@ b1!
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2079" failures="146" expectedFailures="35" skips="12"/>
<OverallResults successes="2075" failures="146" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="312" failures="85" expectedFailures="14" skips="6"/>
</Catch2TestRun>

View File

@ -14,31 +14,20 @@
TEST_CASE( "Character pretty printing" ){
SECTION("Specifically escaped"){
char tab = '\t';
char newline = '\n';
char carr_return = '\r';
char form_feed = '\f';
CHECK(tab == '\t');
CHECK(newline == '\n');
CHECK(carr_return == '\r');
CHECK(form_feed == '\f');
CHECK(::Catch::Detail::stringify('\t') == "'\\t'");
CHECK(::Catch::Detail::stringify('\n') == "'\\n'");
CHECK(::Catch::Detail::stringify('\r') == "'\\r'");
CHECK(::Catch::Detail::stringify('\f') == "'\\f'");
}
SECTION("General chars"){
char space = ' ';
CHECK(space == ' ');
char chars[] = {'a', 'z', 'A', 'Z'};
for (int i = 0; i < 4; ++i){
char c = chars[i];
REQUIRE(c == chars[i]);
}
CHECK(::Catch::Detail::stringify( ' ' ) == "' '" );
CHECK(::Catch::Detail::stringify( 'A' ) == "'A'" );
CHECK(::Catch::Detail::stringify( 'z' ) == "'z'" );
}
SECTION("Low ASCII"){
char null_terminator = '\0';
CHECK(null_terminator == '\0');
for (int i = 2; i < 6; ++i){
char c = static_cast<char>(i);
REQUIRE(c == i);
}
CHECK(::Catch::Detail::stringify( '\0' ) == "0" );
CHECK(::Catch::Detail::stringify( static_cast<char>(2) ) == "2" );
CHECK(::Catch::Detail::stringify( static_cast<char>(5) ) == "5" );
}
}