mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 05:16:10 +01:00
Add test for empty result of filter generator
This commit is contained in:
parent
618d44c448
commit
42d9d4533e
@ -151,6 +151,7 @@ Nor would this
|
||||
:test-result: FAIL FAIL does not require an argument
|
||||
:test-result: FAIL FAIL_CHECK does not abort the test
|
||||
:test-result: PASS Factorials are computed
|
||||
:test-result: PASS Filter generator throws exception for empty generator
|
||||
:test-result: PASS Floating point matchers: double
|
||||
:test-result: PASS Floating point matchers: float
|
||||
:test-result: PASS Generators -- adapters
|
||||
|
@ -149,6 +149,7 @@
|
||||
:test-result: FAIL FAIL does not require an argument
|
||||
:test-result: FAIL FAIL_CHECK does not abort the test
|
||||
:test-result: PASS Factorials are computed
|
||||
:test-result: PASS Filter generator throws exception for empty generator
|
||||
:test-result: PASS Floating point matchers: double
|
||||
:test-result: PASS Floating point matchers: float
|
||||
:test-result: PASS Generators -- adapters
|
||||
|
@ -599,6 +599,7 @@ Misc.tests.cpp:<line number>: passed: Factorial(1) == 1 for: 1 == 1
|
||||
Misc.tests.cpp:<line number>: passed: Factorial(2) == 2 for: 2 == 2
|
||||
Misc.tests.cpp:<line number>: passed: Factorial(3) == 6 for: 6 == 6
|
||||
Misc.tests.cpp:<line number>: passed: Factorial(10) == 3628800 for: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>)
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException
|
||||
Matchers.tests.cpp:<line number>: passed: 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other
|
||||
Matchers.tests.cpp:<line number>: passed: 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other
|
||||
Matchers.tests.cpp:<line number>: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other
|
||||
@ -2522,7 +2523,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
|
||||
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: 408 | 308 passed | 84 failed | 5 skipped | 11 failed as expected
|
||||
assertions: 2210 | 2033 passed | 145 failed | 32 failed as expected
|
||||
test cases: 409 | 309 passed | 84 failed | 5 skipped | 11 failed as expected
|
||||
assertions: 2211 | 2034 passed | 145 failed | 32 failed as expected
|
||||
|
||||
|
||||
|
@ -597,6 +597,7 @@ Misc.tests.cpp:<line number>: passed: Factorial(1) == 1 for: 1 == 1
|
||||
Misc.tests.cpp:<line number>: passed: Factorial(2) == 2 for: 2 == 2
|
||||
Misc.tests.cpp:<line number>: passed: Factorial(3) == 6 for: 6 == 6
|
||||
Misc.tests.cpp:<line number>: passed: Factorial(10) == 3628800 for: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>)
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException
|
||||
Matchers.tests.cpp:<line number>: passed: 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other
|
||||
Matchers.tests.cpp:<line number>: passed: 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other
|
||||
Matchers.tests.cpp:<line number>: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other
|
||||
@ -2511,7 +2512,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
|
||||
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: 408 | 308 passed | 84 failed | 5 skipped | 11 failed as expected
|
||||
assertions: 2210 | 2033 passed | 145 failed | 32 failed as expected
|
||||
test cases: 409 | 309 passed | 84 failed | 5 skipped | 11 failed as expected
|
||||
assertions: 2211 | 2034 passed | 145 failed | 32 failed as expected
|
||||
|
||||
|
||||
|
@ -1533,6 +1533,6 @@ due to unexpected exception with message:
|
||||
Why would you throw a std::string?
|
||||
|
||||
===============================================================================
|
||||
test cases: 408 | 322 passed | 69 failed | 6 skipped | 11 failed as expected
|
||||
assertions: 2193 | 2033 passed | 128 failed | 32 failed as expected
|
||||
test cases: 409 | 323 passed | 69 failed | 6 skipped | 11 failed as expected
|
||||
assertions: 2194 | 2034 passed | 128 failed | 32 failed as expected
|
||||
|
||||
|
@ -4477,6 +4477,15 @@ Misc.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
3628800 (0x<hex digits>) == 3628800 (0x<hex digits>)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Filter generator throws exception for empty generator
|
||||
-------------------------------------------------------------------------------
|
||||
GeneratorsImpl.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THROWS_AS( filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Floating point matchers: double
|
||||
Relative
|
||||
@ -18103,6 +18112,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 408 | 308 passed | 84 failed | 5 skipped | 11 failed as expected
|
||||
assertions: 2210 | 2033 passed | 145 failed | 32 failed as expected
|
||||
test cases: 409 | 309 passed | 84 failed | 5 skipped | 11 failed as expected
|
||||
assertions: 2211 | 2034 passed | 145 failed | 32 failed as expected
|
||||
|
||||
|
@ -4475,6 +4475,15 @@ Misc.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
3628800 (0x<hex digits>) == 3628800 (0x<hex digits>)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Filter generator throws exception for empty generator
|
||||
-------------------------------------------------------------------------------
|
||||
GeneratorsImpl.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THROWS_AS( filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Floating point matchers: double
|
||||
Relative
|
||||
@ -18092,6 +18101,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 408 | 308 passed | 84 failed | 5 skipped | 11 failed as expected
|
||||
assertions: 2210 | 2033 passed | 145 failed | 32 failed as expected
|
||||
test cases: 409 | 309 passed | 84 failed | 5 skipped | 11 failed as expected
|
||||
assertions: 2211 | 2034 passed | 145 failed | 32 failed as expected
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="17" failures="128" skipped="11" tests="2221" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="128" skipped="11" tests="2222" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<properties>
|
||||
<property name="random-seed" value="1"/>
|
||||
<property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/>
|
||||
@ -687,6 +687,7 @@ at Message.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Factorials are computed" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Filter generator throws exception for empty generator" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: double/Relative" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: double/Relative/Some subnormal values" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: double/Margin" time="{duration}" status="run"/>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites>
|
||||
<testsuite name="<exe-name>" errors="17" failures="128" skipped="11" tests="2221" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="128" skipped="11" tests="2222" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<properties>
|
||||
<property name="random-seed" value="1"/>
|
||||
<property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/>
|
||||
@ -686,6 +686,7 @@ at Message.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Factorials are computed" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Filter generator throws exception for empty generator" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: double/Relative" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: double/Relative/Some subnormal values" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="Floating point matchers: double/Margin" time="{duration}" status="run"/>
|
||||
|
@ -71,6 +71,7 @@
|
||||
<testCase name="convertToBits" duration="{duration}"/>
|
||||
</file>
|
||||
<file path="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp">
|
||||
<testCase name="Filter generator throws exception for empty generator" duration="{duration}"/>
|
||||
<testCase name="Generators internals/Single value" duration="{duration}"/>
|
||||
<testCase name="Generators internals/Preset values" duration="{duration}"/>
|
||||
<testCase name="Generators internals/Generator combinator" duration="{duration}"/>
|
||||
|
@ -70,6 +70,7 @@
|
||||
<testCase name="convertToBits" duration="{duration}"/>
|
||||
</file>
|
||||
<file path="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp">
|
||||
<testCase name="Filter generator throws exception for empty generator" duration="{duration}"/>
|
||||
<testCase name="Generators internals/Single value" duration="{duration}"/>
|
||||
<testCase name="Generators internals/Preset values" duration="{duration}"/>
|
||||
<testCase name="Generators internals/Generator combinator" duration="{duration}"/>
|
||||
|
@ -1130,6 +1130,8 @@ ok {test-number} - Factorial(2) == 2 for: 2 == 2
|
||||
ok {test-number} - Factorial(3) == 6 for: 6 == 6
|
||||
# Factorials are computed
|
||||
ok {test-number} - Factorial(10) == 3628800 for: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>)
|
||||
# Filter generator throws exception for empty generator
|
||||
ok {test-number} - filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException
|
||||
# Floating point matchers: double
|
||||
ok {test-number} - 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other
|
||||
# Floating point matchers: double
|
||||
@ -4445,5 +4447,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
||||
ok {test-number} -
|
||||
# xmlentitycheck
|
||||
ok {test-number} -
|
||||
1..2221
|
||||
1..2222
|
||||
|
||||
|
@ -1128,6 +1128,8 @@ ok {test-number} - Factorial(2) == 2 for: 2 == 2
|
||||
ok {test-number} - Factorial(3) == 6 for: 6 == 6
|
||||
# Factorials are computed
|
||||
ok {test-number} - Factorial(10) == 3628800 for: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>)
|
||||
# Filter generator throws exception for empty generator
|
||||
ok {test-number} - filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException
|
||||
# Floating point matchers: double
|
||||
ok {test-number} - 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other
|
||||
# Floating point matchers: double
|
||||
@ -4434,5 +4436,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
||||
ok {test-number} -
|
||||
# xmlentitycheck
|
||||
ok {test-number} -
|
||||
1..2221
|
||||
1..2222
|
||||
|
||||
|
@ -370,6 +370,8 @@
|
||||
##teamcity[testFinished name='FAIL_CHECK does not abort the test' duration="{duration}"]
|
||||
##teamcity[testStarted name='Factorials are computed']
|
||||
##teamcity[testFinished name='Factorials are computed' duration="{duration}"]
|
||||
##teamcity[testStarted name='Filter generator throws exception for empty generator']
|
||||
##teamcity[testFinished name='Filter generator throws exception for empty generator' duration="{duration}"]
|
||||
##teamcity[testStarted name='Floating point matchers: double']
|
||||
##teamcity[testFinished name='Floating point matchers: double' duration="{duration}"]
|
||||
##teamcity[testStarted name='Floating point matchers: float']
|
||||
|
@ -370,6 +370,8 @@
|
||||
##teamcity[testFinished name='FAIL_CHECK does not abort the test' duration="{duration}"]
|
||||
##teamcity[testStarted name='Factorials are computed']
|
||||
##teamcity[testFinished name='Factorials are computed' duration="{duration}"]
|
||||
##teamcity[testStarted name='Filter generator throws exception for empty generator']
|
||||
##teamcity[testFinished name='Filter generator throws exception for empty generator' duration="{duration}"]
|
||||
##teamcity[testStarted name='Floating point matchers: double']
|
||||
##teamcity[testFinished name='Floating point matchers: double' duration="{duration}"]
|
||||
##teamcity[testStarted name='Floating point matchers: float']
|
||||
|
@ -5025,6 +5025,17 @@ C
|
||||
</Expression>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<TestCase name="Filter generator throws exception for empty generator" tags="[generators]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" >
|
||||
<Original>
|
||||
filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException
|
||||
</Original>
|
||||
<Expanded>
|
||||
filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<TestCase name="Floating point matchers: double" tags="[floating-point][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
<Section name="Relative" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
@ -21048,6 +21059,6 @@ b1!
|
||||
</Section>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="2033" failures="145" expectedFailures="32" skips="11"/>
|
||||
<OverallResultsCases successes="308" failures="84" expectedFailures="11" skips="5"/>
|
||||
<OverallResults successes="2034" failures="145" expectedFailures="32" skips="11"/>
|
||||
<OverallResultsCases successes="309" failures="84" expectedFailures="11" skips="5"/>
|
||||
</Catch2TestRun>
|
||||
|
@ -5025,6 +5025,17 @@ C
|
||||
</Expression>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<TestCase name="Filter generator throws exception for empty generator" tags="[generators]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" >
|
||||
<Original>
|
||||
filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException
|
||||
</Original>
|
||||
<Expanded>
|
||||
filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<TestCase name="Floating point matchers: double" tags="[floating-point][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
<Section name="Relative" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
@ -21047,6 +21058,6 @@ b1!
|
||||
</Section>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="2033" failures="145" expectedFailures="32" skips="11"/>
|
||||
<OverallResultsCases successes="308" failures="84" expectedFailures="11" skips="5"/>
|
||||
<OverallResults successes="2034" failures="145" expectedFailures="32" skips="11"/>
|
||||
<OverallResultsCases successes="309" failures="84" expectedFailures="11" skips="5"/>
|
||||
</Catch2TestRun>
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <catch2/generators/catch_generators_adapters.hpp>
|
||||
#include <catch2/generators/catch_generators_random.hpp>
|
||||
#include <catch2/generators/catch_generators_range.hpp>
|
||||
#include <catch2/generators/catch_generator_exception.hpp>
|
||||
|
||||
// Tests of generator implementation details
|
||||
TEST_CASE("Generators internals", "[generators][internals]") {
|
||||
@ -534,3 +535,12 @@ TEST_CASE( "Random generators can be seeded", "[generators][approvals]" ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Filter generator throws exception for empty generator",
|
||||
"[generators]") {
|
||||
using namespace Catch::Generators;
|
||||
|
||||
REQUIRE_THROWS_AS(
|
||||
filter( []( int ) { return false; }, value( 3 ) ),
|
||||
Catch::GeneratorException );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user