mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
@@ -1003,6 +1003,6 @@ with expansion:
|
||||
"{?}" == "1"
|
||||
|
||||
===============================================================================
|
||||
test cases: 185 | 134 passed | 47 failed | 4 failed as expected
|
||||
assertions: 904 | 787 passed | 96 failed | 21 failed as expected
|
||||
test cases: 187 | 136 passed | 47 failed | 4 failed as expected
|
||||
assertions: 935 | 818 passed | 96 failed | 21 failed as expected
|
||||
|
||||
|
@@ -1717,6 +1717,234 @@ PASSED:
|
||||
with expansion:
|
||||
3628800 (0x<hex digits>) == 3628800 (0x<hex digits>)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Floating point matchers: double
|
||||
Margin
|
||||
-------------------------------------------------------------------------------
|
||||
MatchersTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 1., WithinAbs(1., 0) )
|
||||
with expansion:
|
||||
1.0 is within 0.000000 of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 0., WithinAbs(1., 1) )
|
||||
with expansion:
|
||||
0.0 is within 1.000000 of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 0., !WithinAbs(1., 0.99) )
|
||||
with expansion:
|
||||
0.0 not is within 0.990000 of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 0., !WithinAbs(1., 0.99) )
|
||||
with expansion:
|
||||
0.0 not is within 0.990000 of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( NAN, !WithinAbs(NAN, 0) )
|
||||
with expansion:
|
||||
nanf not is within 0.000000 of nan
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Floating point matchers: double
|
||||
ULPs
|
||||
-------------------------------------------------------------------------------
|
||||
MatchersTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 1., WithinULP(1., 0) )
|
||||
with expansion:
|
||||
1.0 is within 0 ULPs of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( std::nextafter(1., 2.), WithinULP(1., 1) )
|
||||
with expansion:
|
||||
1.0 is within 1 ULPs of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( std::nextafter(1., 0.), WithinULP(1., 1) )
|
||||
with expansion:
|
||||
1.0 is within 1 ULPs of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( std::nextafter(1., 2.), !WithinULP(1., 0) )
|
||||
with expansion:
|
||||
1.0 not is within 0 ULPs of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 1., WithinULP(1., 0) )
|
||||
with expansion:
|
||||
1.0 is within 0 ULPs of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( -0., WithinULP(0., 0) )
|
||||
with expansion:
|
||||
-0.0 is within 0 ULPs of 0.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( NAN, !WithinULP(NAN, 123) )
|
||||
with expansion:
|
||||
nanf not is within 123 ULPs of nanf
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Floating point matchers: double
|
||||
Composed
|
||||
-------------------------------------------------------------------------------
|
||||
MatchersTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 1., WithinAbs(1., 0.5) || WithinULP(2., 1) )
|
||||
with expansion:
|
||||
1.0 ( is within 0.500000 of 1.000000 or is within 1 ULPs of 2.000000 )
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 1., WithinAbs(2., 0.5) || WithinULP(1., 0) )
|
||||
with expansion:
|
||||
1.0 ( is within 0.500000 of 2.000000 or is within 0 ULPs of 1.000000 )
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123)) )
|
||||
with expansion:
|
||||
nanf not ( is within 100.000000 of nan or is within 123 ULPs of nanf )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Floating point matchers: float
|
||||
Margin
|
||||
-------------------------------------------------------------------------------
|
||||
MatchersTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 1.f, WithinAbs(1.f, 0) )
|
||||
with expansion:
|
||||
1.0f is within 0.000000 of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 0.f, WithinAbs(1.f, 1) )
|
||||
with expansion:
|
||||
0.0f is within 1.000000 of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 0.f, !WithinAbs(1.f, 0.99f) )
|
||||
with expansion:
|
||||
0.0f not is within 0.990000 of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 0.f, !WithinAbs(1.f, 0.99f) )
|
||||
with expansion:
|
||||
0.0f not is within 0.990000 of 1.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 0.f, WithinAbs(-0.f, 0) )
|
||||
with expansion:
|
||||
0.0f is within 0.000000 of -0.000000
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( NAN, !WithinAbs(NAN, 0) )
|
||||
with expansion:
|
||||
nanf not is within 0.000000 of nan
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Floating point matchers: float
|
||||
ULPs
|
||||
-------------------------------------------------------------------------------
|
||||
MatchersTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 1.f, WithinULP(1.f, 0) )
|
||||
with expansion:
|
||||
1.0f is within 0 ULPs of 1.000000f
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( std::nextafter(1.f, 2.f), WithinULP(1.f, 1) )
|
||||
with expansion:
|
||||
1.0f is within 1 ULPs of 1.000000f
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( std::nextafter(1.f, 0.f), WithinULP(1.f, 1) )
|
||||
with expansion:
|
||||
1.0f is within 1 ULPs of 1.000000f
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( std::nextafter(1.f, 2.f), !WithinULP(1.f, 0) )
|
||||
with expansion:
|
||||
1.0f not is within 0 ULPs of 1.000000f
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 1.f, WithinULP(1.f, 0) )
|
||||
with expansion:
|
||||
1.0f is within 0 ULPs of 1.000000f
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( -0.f, WithinULP(0.f, 0) )
|
||||
with expansion:
|
||||
-0.0f is within 0 ULPs of 0.000000f
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( NAN, !WithinULP(NAN, 123) )
|
||||
with expansion:
|
||||
nanf not is within 123 ULPs of nanf
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Floating point matchers: float
|
||||
Composed
|
||||
-------------------------------------------------------------------------------
|
||||
MatchersTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1) )
|
||||
with expansion:
|
||||
1.0f ( is within 0.500000 of 1.000000 or is within 1 ULPs of 1.000000f )
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( 1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0) )
|
||||
with expansion:
|
||||
1.0f ( is within 0.500000 of 2.000000 or is within 0 ULPs of 1.000000f )
|
||||
|
||||
MatchersTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THAT( NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123)) )
|
||||
with expansion:
|
||||
nanf not ( is within 100.000000 of nan or is within 123 ULPs of nanf )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Greater-than inequalities with different epsilons
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -7632,6 +7860,6 @@ MiscTests.cpp:<line number>:
|
||||
PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 185 | 132 passed | 49 failed | 4 failed as expected
|
||||
assertions: 903 | 783 passed | 99 failed | 21 failed as expected
|
||||
test cases: 187 | 134 passed | 49 failed | 4 failed as expected
|
||||
assertions: 934 | 814 passed | 99 failed | 21 failed as expected
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="15" failures="85" tests="904" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="15" failures="85" tests="935" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}">
|
||||
@@ -263,6 +263,12 @@ MessageTests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Factorials are computed" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: double/Margin" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: double/ULPs" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: double/Composed" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: float/Margin" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: float/ULPs" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: float/Composed" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Greater-than inequalities with different epsilons" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="INFO and WARN do not abort tests" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="INFO gets logged on failure" time="{duration}">
|
||||
|
@@ -1945,6 +1945,278 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Floating point matchers: double" tags="[floating-point][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Section name="Margin" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
1., WithinAbs(1., 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0 is within 0.000000 of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
0., WithinAbs(1., 1)
|
||||
</Original>
|
||||
<Expanded>
|
||||
0.0 is within 1.000000 of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
0., !WithinAbs(1., 0.99)
|
||||
</Original>
|
||||
<Expanded>
|
||||
0.0 not is within 0.990000 of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
0., !WithinAbs(1., 0.99)
|
||||
</Original>
|
||||
<Expanded>
|
||||
0.0 not is within 0.990000 of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
NAN, !WithinAbs(NAN, 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
nanf not is within 0.000000 of nan
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="5" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="ULPs" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
1., WithinULP(1., 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0 is within 0 ULPs of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
std::nextafter(1., 2.), WithinULP(1., 1)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0 is within 1 ULPs of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
std::nextafter(1., 0.), WithinULP(1., 1)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0 is within 1 ULPs of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
std::nextafter(1., 2.), !WithinULP(1., 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0 not is within 0 ULPs of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
1., WithinULP(1., 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0 is within 0 ULPs of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
-0., WithinULP(0., 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
-0.0 is within 0 ULPs of 0.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
NAN, !WithinULP(NAN, 123)
|
||||
</Original>
|
||||
<Expanded>
|
||||
nanf not is within 123 ULPs of nanf
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="7" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="Composed" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
1., WithinAbs(1., 0.5) || WithinULP(2., 1)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0 ( is within 0.500000 of 1.000000 or is within 1 ULPs of 2.000000 )
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
1., WithinAbs(2., 0.5) || WithinULP(1., 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0 ( is within 0.500000 of 2.000000 or is within 0 ULPs of 1.000000 )
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123))
|
||||
</Original>
|
||||
<Expanded>
|
||||
nanf not ( is within 100.000000 of nan or is within 123 ULPs of nanf )
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Floating point matchers: float" tags="[floating-point][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Section name="Margin" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
1.f, WithinAbs(1.f, 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0f is within 0.000000 of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
0.f, WithinAbs(1.f, 1)
|
||||
</Original>
|
||||
<Expanded>
|
||||
0.0f is within 1.000000 of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
0.f, !WithinAbs(1.f, 0.99f)
|
||||
</Original>
|
||||
<Expanded>
|
||||
0.0f not is within 0.990000 of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
0.f, !WithinAbs(1.f, 0.99f)
|
||||
</Original>
|
||||
<Expanded>
|
||||
0.0f not is within 0.990000 of 1.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
0.f, WithinAbs(-0.f, 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
0.0f is within 0.000000 of -0.000000
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
NAN, !WithinAbs(NAN, 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
nanf not is within 0.000000 of nan
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="6" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="ULPs" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
1.f, WithinULP(1.f, 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0f is within 0 ULPs of 1.000000f
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
std::nextafter(1.f, 2.f), WithinULP(1.f, 1)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0f is within 1 ULPs of 1.000000f
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
std::nextafter(1.f, 0.f), WithinULP(1.f, 1)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0f is within 1 ULPs of 1.000000f
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
std::nextafter(1.f, 2.f), !WithinULP(1.f, 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0f not is within 0 ULPs of 1.000000f
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
1.f, WithinULP(1.f, 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0f is within 0 ULPs of 1.000000f
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
-0.f, WithinULP(0.f, 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
-0.0f is within 0 ULPs of 0.000000f
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
NAN, !WithinULP(NAN, 123)
|
||||
</Original>
|
||||
<Expanded>
|
||||
nanf not is within 123 ULPs of nanf
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="7" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="Composed" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0f ( is within 0.500000 of 1.000000 or is within 1 ULPs of 1.000000f )
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0)
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0f ( is within 0.500000 of 2.000000 or is within 0 ULPs of 1.000000f )
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123))
|
||||
</Original>
|
||||
<Expanded>
|
||||
nanf not ( is within 100.000000 of nan or is within 123 ULPs of nanf )
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Greater-than inequalities with different epsilons" tags="[Approx]" filename="projects/<exe-name>/ApproxTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ApproxTests.cpp" >
|
||||
<Original>
|
||||
@@ -8446,7 +8718,7 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="783" failures="100" expectedFailures="21"/>
|
||||
<OverallResults successes="814" failures="100" expectedFailures="21"/>
|
||||
</Group>
|
||||
<OverallResults successes="783" failures="99" expectedFailures="21"/>
|
||||
<OverallResults successes="814" failures="99" expectedFailures="21"/>
|
||||
</Catch>
|
||||
|
@@ -226,6 +226,67 @@ TEST_CASE("Exception matchers that fail", "[matchers][exceptions][!throws][.fail
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Floating point matchers: float", "[matchers][floating-point]") {
|
||||
SECTION("Margin") {
|
||||
REQUIRE_THAT(1.f, WithinAbs(1.f, 0));
|
||||
REQUIRE_THAT(0.f, WithinAbs(1.f, 1));
|
||||
|
||||
REQUIRE_THAT(0.f, !WithinAbs(1.f, 0.99f));
|
||||
REQUIRE_THAT(0.f, !WithinAbs(1.f, 0.99f));
|
||||
|
||||
REQUIRE_THAT(0.f, WithinAbs(-0.f, 0));
|
||||
REQUIRE_THAT(NAN, !WithinAbs(NAN, 0));
|
||||
}
|
||||
SECTION("ULPs") {
|
||||
REQUIRE_THAT(1.f, WithinULP(1.f, 0));
|
||||
|
||||
REQUIRE_THAT(std::nextafter(1.f, 2.f), WithinULP(1.f, 1));
|
||||
REQUIRE_THAT(std::nextafter(1.f, 0.f), WithinULP(1.f, 1));
|
||||
REQUIRE_THAT(std::nextafter(1.f, 2.f), !WithinULP(1.f, 0));
|
||||
|
||||
REQUIRE_THAT(1.f, WithinULP(1.f, 0));
|
||||
REQUIRE_THAT(-0.f, WithinULP(0.f, 0));
|
||||
|
||||
REQUIRE_THAT(NAN, !WithinULP(NAN, 123));
|
||||
}
|
||||
SECTION("Composed") {
|
||||
REQUIRE_THAT(1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1));
|
||||
REQUIRE_THAT(1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0));
|
||||
|
||||
REQUIRE_THAT(NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123)));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Floating point matchers: double", "[matchers][floating-point]") {
|
||||
SECTION("Margin") {
|
||||
REQUIRE_THAT(1., WithinAbs(1., 0));
|
||||
REQUIRE_THAT(0., WithinAbs(1., 1));
|
||||
|
||||
REQUIRE_THAT(0., !WithinAbs(1., 0.99));
|
||||
REQUIRE_THAT(0., !WithinAbs(1., 0.99));
|
||||
|
||||
REQUIRE_THAT(NAN, !WithinAbs(NAN, 0));
|
||||
}
|
||||
SECTION("ULPs") {
|
||||
REQUIRE_THAT(1., WithinULP(1., 0));
|
||||
|
||||
REQUIRE_THAT(std::nextafter(1., 2.), WithinULP(1., 1));
|
||||
REQUIRE_THAT(std::nextafter(1., 0.), WithinULP(1., 1));
|
||||
REQUIRE_THAT(std::nextafter(1., 2.), !WithinULP(1., 0));
|
||||
|
||||
REQUIRE_THAT(1., WithinULP(1., 0));
|
||||
REQUIRE_THAT(-0., WithinULP(0., 0));
|
||||
|
||||
REQUIRE_THAT(NAN, !WithinULP(NAN, 123));
|
||||
}
|
||||
SECTION("Composed") {
|
||||
REQUIRE_THAT(1., WithinAbs(1., 0.5) || WithinULP(2., 1));
|
||||
REQUIRE_THAT(1., WithinAbs(2., 0.5) || WithinULP(1., 0));
|
||||
|
||||
REQUIRE_THAT(NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123)));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
||||
|
||||
#ifdef __clang__
|
||||
|
Reference in New Issue
Block a user