mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Add CaseInsensitiveEqualTo comparison type
This commit is contained in:
parent
156e6fdfa9
commit
cbb6764fb1
@ -22,5 +22,14 @@ namespace Catch {
|
|||||||
[]( char l, char r ) { return toLower( l ) < toLower( r ); } );
|
[]( char l, char r ) { return toLower( l ) < toLower( r ); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CaseInsensitiveEqualTo::operator()( StringRef lhs,
|
||||||
|
StringRef rhs ) const {
|
||||||
|
return std::equal(
|
||||||
|
lhs.begin(), lhs.end(),
|
||||||
|
rhs.begin(), rhs.end(),
|
||||||
|
[]( char l, char r ) { return toLower( l ) == toLower( r ); } );
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Detail
|
} // namespace Detail
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
@ -20,6 +20,12 @@ namespace Catch {
|
|||||||
StringRef rhs ) const;
|
StringRef rhs ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Provides case-insensitive `op==` semantics when called
|
||||||
|
struct CaseInsensitiveEqualTo {
|
||||||
|
bool operator()( StringRef lhs,
|
||||||
|
StringRef rhs ) const;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Detail
|
} // namespace Detail
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
|
@ -100,6 +100,8 @@ Nor would this
|
|||||||
:test-result: PASS CAPTURE can deal with complex expressions involving commas
|
:test-result: PASS CAPTURE can deal with complex expressions involving commas
|
||||||
:test-result: PASS CAPTURE parses string and character constants
|
:test-result: PASS CAPTURE parses string and character constants
|
||||||
:test-result: PASS Capture and info messages
|
:test-result: PASS Capture and info messages
|
||||||
|
:test-result: PASS CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
:test-result: PASS CaseInsensitiveLess is case insensitive
|
||||||
:test-result: PASS Character pretty printing
|
:test-result: PASS Character pretty printing
|
||||||
:test-result: PASS Clara::Arg supports single-arg parse the way Opt does
|
:test-result: PASS Clara::Arg supports single-arg parse the way Opt does
|
||||||
:test-result: PASS Clara::Opt supports accept-many lambdas
|
:test-result: PASS Clara::Opt supports accept-many lambdas
|
||||||
|
@ -334,6 +334,21 @@ Message.tests.cpp:<line number>: passed: with 7 messages: 'std::vector<int>{1, 2
|
|||||||
Message.tests.cpp:<line number>: passed: with 11 messages: '("comma, in string", "escaped, \", ") := "escaped, ", "' and '"single quote in string,'," := "single quote in string,',"' and '"some escapes, \\,\\\\" := "some escapes, \,\\"' and '"some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<"' and ''"' := '"'' and ''\'' := '''' and '',' := ','' and ''}' := '}'' and '')' := ')'' and ''(' := '('' and ''{' := '{''
|
Message.tests.cpp:<line number>: passed: with 11 messages: '("comma, in string", "escaped, \", ") := "escaped, ", "' and '"single quote in string,'," := "single quote in string,',"' and '"some escapes, \\,\\\\" := "some escapes, \,\\"' and '"some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<"' and ''"' := '"'' and ''\'' := '''' and '',' := ','' and ''}' := '}'' and '')' := ')'' and ''(' := '('' and ''{' := '{''
|
||||||
ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: 'i := 2'
|
ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: 'i := 2'
|
||||||
ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: '3'
|
ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: '3'
|
||||||
|
Details.tests.cpp:<line number>: passed: eq( "", "" ) for: true
|
||||||
|
Details.tests.cpp:<line number>: passed: !(eq( "", "a" )) for: !false
|
||||||
|
Details.tests.cpp:<line number>: passed: eq( "a", "a" ) for: true
|
||||||
|
Details.tests.cpp:<line number>: passed: eq( "a", "A" ) for: true
|
||||||
|
Details.tests.cpp:<line number>: passed: eq( "A", "a" ) for: true
|
||||||
|
Details.tests.cpp:<line number>: passed: eq( "A", "A" ) for: true
|
||||||
|
Details.tests.cpp:<line number>: passed: !(eq( "a", "b" )) for: !false
|
||||||
|
Details.tests.cpp:<line number>: passed: !(eq( "a", "B" )) for: !false
|
||||||
|
Details.tests.cpp:<line number>: passed: lt( "", "a" ) for: true
|
||||||
|
Details.tests.cpp:<line number>: passed: !(lt( "a", "a" )) for: !false
|
||||||
|
Details.tests.cpp:<line number>: passed: !(lt( "", "" )) for: !false
|
||||||
|
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: tab == '\t' for: '\t' == '\t'
|
||||||
ToStringGeneral.tests.cpp:<line number>: passed: newline == '\n' for: '\n' == '\n'
|
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: carr_return == '\r' for: '\r' == '\r'
|
||||||
|
@ -1426,6 +1426,6 @@ due to unexpected exception with message:
|
|||||||
Why would you throw a std::string?
|
Why would you throw a std::string?
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 377 | 300 passed | 70 failed | 7 failed as expected
|
test cases: 379 | 302 passed | 70 failed | 7 failed as expected
|
||||||
assertions: 2154 | 1998 passed | 129 failed | 27 failed as expected
|
assertions: 2169 | 2013 passed | 129 failed | 27 failed as expected
|
||||||
|
|
||||||
|
@ -2801,6 +2801,109 @@ ToStringGeneral.tests.cpp:<line number>: PASSED:
|
|||||||
with message:
|
with message:
|
||||||
3
|
3
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
Degenerate cases
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Details.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( eq( "", "" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE_FALSE( eq( "", "a" ) )
|
||||||
|
with expansion:
|
||||||
|
!false
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
Plain comparisons
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Details.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( eq( "a", "a" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( eq( "a", "A" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( eq( "A", "a" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( eq( "A", "A" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE_FALSE( eq( "a", "b" ) )
|
||||||
|
with expansion:
|
||||||
|
!false
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE_FALSE( eq( "a", "B" ) )
|
||||||
|
with expansion:
|
||||||
|
!false
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
CaseInsensitiveLess is case insensitive
|
||||||
|
Degenerate cases
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Details.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( lt( "", "a" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE_FALSE( lt( "a", "a" ) )
|
||||||
|
with expansion:
|
||||||
|
!false
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE_FALSE( lt( "", "" ) )
|
||||||
|
with expansion:
|
||||||
|
!false
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
CaseInsensitiveLess is case insensitive
|
||||||
|
Plain comparisons
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Details.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( lt( "a", "b" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( lt( "a", "B" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( lt( "A", "b" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Details.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( lt( "A", "B" ) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Character pretty printing
|
Character pretty printing
|
||||||
Specifically escaped
|
Specifically escaped
|
||||||
@ -17321,6 +17424,6 @@ Misc.tests.cpp:<line number>
|
|||||||
Misc.tests.cpp:<line number>: PASSED:
|
Misc.tests.cpp:<line number>: PASSED:
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 377 | 284 passed | 86 failed | 7 failed as expected
|
test cases: 379 | 286 passed | 86 failed | 7 failed as expected
|
||||||
assertions: 2171 | 1998 passed | 146 failed | 27 failed as expected
|
assertions: 2186 | 2013 passed | 146 failed | 27 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="129" tests="2171" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
<testsuite name="<exe-name>" errors="17" failures="129" tests="2186" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="random-seed" value="1"/>
|
<property name="random-seed" value="1"/>
|
||||||
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
|
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
|
||||||
@ -378,6 +378,10 @@ Exception.tests.cpp:<line number>
|
|||||||
<testcase classname="<exe-name>.global" name="CAPTURE parses string and character constants" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="CAPTURE parses string and character constants" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Capture and info messages/Capture should stringify like assertions" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Capture and info messages/Capture should stringify like assertions" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Capture and info messages/Info should NOT stringify the way assertions do" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Capture and info messages/Info should NOT stringify the way assertions do" time="{duration}" status="run"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="CaseInsensitiveEqualsTo is case insensitive/Degenerate cases" time="{duration}" status="run"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="CaseInsensitiveEqualsTo is case insensitive/Plain comparisons" time="{duration}" status="run"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="CaseInsensitiveLess is case insensitive/Degenerate cases" time="{duration}" status="run"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="CaseInsensitiveLess is case insensitive/Plain comparisons" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Character pretty printing/Specifically escaped" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Character pretty printing/Specifically escaped" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Character pretty printing/General chars" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Character pretty printing/General chars" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Character pretty printing/Low ASCII" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Character pretty printing/Low ASCII" time="{duration}" status="run"/>
|
||||||
|
@ -89,6 +89,12 @@
|
|||||||
<testCase name="Process can be configured on command line/Benchmark options/warmup-time" duration="{duration}"/>
|
<testCase name="Process can be configured on command line/Benchmark options/warmup-time" duration="{duration}"/>
|
||||||
<testCase name="Test with special, characters "in name" duration="{duration}"/>
|
<testCase name="Test with special, characters "in name" duration="{duration}"/>
|
||||||
</file>
|
</file>
|
||||||
|
<file path="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp">
|
||||||
|
<testCase name="CaseInsensitiveEqualsTo is case insensitive/Degenerate cases" duration="{duration}"/>
|
||||||
|
<testCase name="CaseInsensitiveEqualsTo is case insensitive/Plain comparisons" duration="{duration}"/>
|
||||||
|
<testCase name="CaseInsensitiveLess is case insensitive/Degenerate cases" duration="{duration}"/>
|
||||||
|
<testCase name="CaseInsensitiveLess is case insensitive/Plain comparisons" duration="{duration}"/>
|
||||||
|
</file>
|
||||||
<file path="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp">
|
<file path="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp">
|
||||||
<testCase name="convertToBits" duration="{duration}"/>
|
<testCase name="convertToBits" duration="{duration}"/>
|
||||||
</file>
|
</file>
|
||||||
|
@ -666,6 +666,36 @@ ok {test-number} - with 11 messages: '("comma, in string", "escaped, \", ") := "
|
|||||||
ok {test-number} - true with 1 message: 'i := 2'
|
ok {test-number} - true with 1 message: 'i := 2'
|
||||||
# Capture and info messages
|
# Capture and info messages
|
||||||
ok {test-number} - true with 1 message: '3'
|
ok {test-number} - true with 1 message: '3'
|
||||||
|
# CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
ok {test-number} - eq( "", "" ) for: true
|
||||||
|
# CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
ok {test-number} - !(eq( "", "a" )) for: !false
|
||||||
|
# CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
ok {test-number} - eq( "a", "a" ) for: true
|
||||||
|
# CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
ok {test-number} - eq( "a", "A" ) for: true
|
||||||
|
# CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
ok {test-number} - eq( "A", "a" ) for: true
|
||||||
|
# CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
ok {test-number} - eq( "A", "A" ) for: true
|
||||||
|
# CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
ok {test-number} - !(eq( "a", "b" )) for: !false
|
||||||
|
# CaseInsensitiveEqualsTo is case insensitive
|
||||||
|
ok {test-number} - !(eq( "a", "B" )) for: !false
|
||||||
|
# CaseInsensitiveLess is case insensitive
|
||||||
|
ok {test-number} - lt( "", "a" ) for: true
|
||||||
|
# CaseInsensitiveLess is case insensitive
|
||||||
|
ok {test-number} - !(lt( "a", "a" )) for: !false
|
||||||
|
# CaseInsensitiveLess is case insensitive
|
||||||
|
ok {test-number} - !(lt( "", "" )) for: !false
|
||||||
|
# CaseInsensitiveLess is case insensitive
|
||||||
|
ok {test-number} - lt( "a", "b" ) for: true
|
||||||
|
# CaseInsensitiveLess is case insensitive
|
||||||
|
ok {test-number} - lt( "a", "B" ) for: true
|
||||||
|
# CaseInsensitiveLess is case insensitive
|
||||||
|
ok {test-number} - lt( "A", "b" ) for: true
|
||||||
|
# CaseInsensitiveLess is case insensitive
|
||||||
|
ok {test-number} - lt( "A", "B" ) for: true
|
||||||
# Character pretty printing
|
# Character pretty printing
|
||||||
ok {test-number} - tab == '\t' for: '\t' == '\t'
|
ok {test-number} - tab == '\t' for: '\t' == '\t'
|
||||||
# Character pretty printing
|
# Character pretty printing
|
||||||
@ -4344,5 +4374,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
|||||||
ok {test-number} -
|
ok {test-number} -
|
||||||
# xmlentitycheck
|
# xmlentitycheck
|
||||||
ok {test-number} -
|
ok {test-number} -
|
||||||
1..2171
|
1..2186
|
||||||
|
|
||||||
|
@ -233,6 +233,10 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe
|
|||||||
##teamcity[testFinished name='CAPTURE parses string and character constants' duration="{duration}"]
|
##teamcity[testFinished name='CAPTURE parses string and character constants' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Capture and info messages']
|
##teamcity[testStarted name='Capture and info messages']
|
||||||
##teamcity[testFinished name='Capture and info messages' duration="{duration}"]
|
##teamcity[testFinished name='Capture and info messages' duration="{duration}"]
|
||||||
|
##teamcity[testStarted name='CaseInsensitiveEqualsTo is case insensitive']
|
||||||
|
##teamcity[testFinished name='CaseInsensitiveEqualsTo is case insensitive' duration="{duration}"]
|
||||||
|
##teamcity[testStarted name='CaseInsensitiveLess is case insensitive']
|
||||||
|
##teamcity[testFinished name='CaseInsensitiveLess is case insensitive' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Character pretty printing']
|
##teamcity[testStarted name='Character pretty printing']
|
||||||
##teamcity[testFinished name='Character pretty printing' duration="{duration}"]
|
##teamcity[testFinished name='Character pretty printing' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Clara::Arg supports single-arg parse the way Opt does']
|
##teamcity[testStarted name='Clara::Arg supports single-arg parse the way Opt does']
|
||||||
|
@ -3013,6 +3013,144 @@ Nor would this
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="CaseInsensitiveEqualsTo is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
eq( "", "" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
!(eq( "", "a" ))
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
!false
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="Plain comparisons" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
eq( "a", "a" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
eq( "a", "A" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
eq( "A", "a" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
eq( "A", "A" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
!(eq( "a", "b" ))
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
!false
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
!(eq( "a", "B" ))
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
!false
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="6" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
|
<TestCase name="CaseInsensitiveLess is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
lt( "", "a" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
!(lt( "a", "a" ))
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
!false
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
!(lt( "", "" ))
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
!false
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="Plain comparisons" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
lt( "a", "b" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
lt( "a", "B" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
lt( "A", "b" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
lt( "A", "B" )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="Character pretty printing" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
|
<TestCase name="Character pretty printing" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
|
||||||
<Section name="Specifically escaped" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
|
<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" >
|
<Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
|
||||||
@ -20290,6 +20428,6 @@ loose text artifact
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="1998" failures="146" expectedFailures="27"/>
|
<OverallResults successes="2013" failures="146" expectedFailures="27"/>
|
||||||
<OverallResultsCases successes="284" failures="86" expectedFailures="7"/>
|
<OverallResultsCases successes="286" failures="86" expectedFailures="7"/>
|
||||||
</Catch2TestRun>
|
</Catch2TestRun>
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include <catch2/internal/catch_enforce.hpp>
|
#include <catch2/internal/catch_enforce.hpp>
|
||||||
|
#include <catch2/internal/catch_case_insensitive_comparisons.hpp>
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
@ -22,3 +23,35 @@ TEST_CASE("Check that our error handling macros throw the right exceptions", "[!
|
|||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(pop) // unreachable code in the macro expansions
|
#pragma warning(pop) // unreachable code in the macro expansions
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
TEST_CASE("CaseInsensitiveLess is case insensitive", "[comparisons][string-case]") {
|
||||||
|
Catch::Detail::CaseInsensitiveLess lt;
|
||||||
|
SECTION( "Degenerate cases" ) {
|
||||||
|
REQUIRE( lt( "", "a" ) );
|
||||||
|
REQUIRE_FALSE( lt( "a", "a" ) );
|
||||||
|
REQUIRE_FALSE( lt( "", "" ) );
|
||||||
|
}
|
||||||
|
SECTION("Plain comparisons") {
|
||||||
|
REQUIRE( lt( "a", "b" ) );
|
||||||
|
REQUIRE( lt( "a", "B" ) );
|
||||||
|
REQUIRE( lt( "A", "b" ) );
|
||||||
|
REQUIRE( lt( "A", "B" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE( "CaseInsensitiveEqualsTo is case insensitive",
|
||||||
|
"[comparisons][string-case]" ) {
|
||||||
|
Catch::Detail::CaseInsensitiveEqualTo eq;
|
||||||
|
SECTION( "Degenerate cases" ) {
|
||||||
|
REQUIRE( eq( "", "" ) );
|
||||||
|
REQUIRE_FALSE( eq( "", "a" ) );
|
||||||
|
}
|
||||||
|
SECTION( "Plain comparisons" ) {
|
||||||
|
REQUIRE( eq( "a", "a" ) );
|
||||||
|
REQUIRE( eq( "a", "A" ) );
|
||||||
|
REQUIRE( eq( "A", "a" ) );
|
||||||
|
REQUIRE( eq( "A", "A" ) );
|
||||||
|
REQUIRE_FALSE( eq( "a", "b" ) );
|
||||||
|
REQUIRE_FALSE( eq( "a", "B" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user