From 3701c2e2e645df69e28914c72bf5c75158fa6613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 4 Aug 2019 13:50:25 +0200 Subject: [PATCH] Small cleanup of self tests --- .../Baselines/compact.sw.approved.txt | 4 +- .../Baselines/console.sw.approved.txt | 32 ++++++++-------- .../Baselines/console.swa4.approved.txt | 20 +++++++++- .../SelfTest/Baselines/junit.sw.approved.txt | 2 +- .../SelfTest/Baselines/xml.sw.approved.txt | 38 +++++++++---------- .../SelfTest/UsageTests/Compilation.tests.cpp | 27 ++++++++++++- projects/SelfTest/UsageTests/Misc.tests.cpp | 6 --- projects/SelfTest/UsageTests/Tricky.tests.cpp | 26 ------------- 8 files changed, 82 insertions(+), 73 deletions(-) diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt index b2edd620..45a37c57 100644 --- a/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -3,6 +3,8 @@ Decomposition.tests.cpp:: passed: fptr == 0 for: 0 == 0 Decomposition.tests.cpp:: passed: fptr == 0l for: 0 == 0 Compilation.tests.cpp:: passed: y.v == 0 for: 0 == 0 Compilation.tests.cpp:: passed: 0 == y.v for: 0 == 0 +Compilation.tests.cpp:: passed: y.v == 0 for: 0 == 0 +Compilation.tests.cpp:: passed: 0 == y.v for: 0 == 0 Compilation.tests.cpp:: passed: t1 == t2 for: {?} == {?} Compilation.tests.cpp:: passed: t1 != t2 for: {?} != {?} Compilation.tests.cpp:: passed: t1 < t2 for: {?} < {?} @@ -244,8 +246,6 @@ Tricky.tests.cpp:: passed: true Approx.tests.cpp:: passed: INFINITY == Approx(INFINITY) for: inff == Approx( inf ) Approx.tests.cpp:: passed: NAN != Approx(NAN) for: nanf != Approx( nan ) Approx.tests.cpp:: passed: !(NAN == Approx(NAN)) for: !(nanf == Approx( nan )) -Tricky.tests.cpp:: passed: y.v == 0 for: 0 == 0 -Tricky.tests.cpp:: passed: 0 == y.v for: 0 == 0 Message.tests.cpp:: passed: with 7 messages: 'a := 1' and 'b := 2' and 'c := 3' and 'a + b := 3' and 'a+b := 3' and 'c > b := true' and 'a == 1 := true' Message.tests.cpp:: passed: with 7 messages: 'std::vector{1, 2, 3}[0, 1, 2] := 3' and 'std::vector{1, 2, 3}[(0, 1)] := 2' and 'std::vector{1, 2, 3}[0] := 1' and '(helper_1436{12, -12}) := { 12, -12 }' and '(helper_1436(-12, 12)) := { -12, 12 }' and '(1, 2) := 2' and '(2, 3) := 3' Message.tests.cpp:: 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 ''{' := '{'' diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index dfc9f0ba..73c23901 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -39,6 +39,22 @@ with expansion: Compilation.tests.cpp: ............................................................................... +Compilation.tests.cpp:: PASSED: + REQUIRE( y.v == 0 ) +with expansion: + 0 == 0 + +Compilation.tests.cpp:: PASSED: + REQUIRE( 0 == y.v ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +#1027: Bitfields can be captured +------------------------------------------------------------------------------- +Compilation.tests.cpp: +............................................................................... + Compilation.tests.cpp:: PASSED: REQUIRE( y.v == 0 ) with expansion: @@ -1944,22 +1960,6 @@ Approx.tests.cpp:: PASSED: with expansion: !(nanf == Approx( nan )) -------------------------------------------------------------------------------- -Bitfields can be captured (#1027) -------------------------------------------------------------------------------- -Tricky.tests.cpp: -............................................................................... - -Tricky.tests.cpp:: PASSED: - REQUIRE( y.v == 0 ) -with expansion: - 0 == 0 - -Tricky.tests.cpp:: PASSED: - REQUIRE( 0 == y.v ) -with expansion: - 0 == 0 - ------------------------------------------------------------------------------- CAPTURE can deal with complex expressions ------------------------------------------------------------------------------- diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt index bfa66750..322b8158 100644 --- a/projects/SelfTest/Baselines/console.swa4.approved.txt +++ b/projects/SelfTest/Baselines/console.swa4.approved.txt @@ -39,6 +39,22 @@ with expansion: Compilation.tests.cpp: ............................................................................... +Compilation.tests.cpp:: PASSED: + REQUIRE( y.v == 0 ) +with expansion: + 0 == 0 + +Compilation.tests.cpp:: PASSED: + REQUIRE( 0 == y.v ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +#1027: Bitfields can be captured +------------------------------------------------------------------------------- +Compilation.tests.cpp: +............................................................................... + Compilation.tests.cpp:: PASSED: REQUIRE( y.v == 0 ) with expansion: @@ -352,6 +368,6 @@ Condition.tests.cpp:: FAILED: CHECK( true != true ) =============================================================================== -test cases: 18 | 13 passed | 3 failed | 2 failed as expected -assertions: 40 | 33 passed | 4 failed | 3 failed as expected +test cases: 19 | 14 passed | 3 failed | 2 failed as expected +assertions: 42 | 35 passed | 4 failed | 3 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 77a1926d..2cd6081e 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -9,6 +9,7 @@ + @@ -232,7 +233,6 @@ Exception.tests.cpp: - diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 7715a043..05875d0a 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -43,6 +43,25 @@ + + + + y.v == 0 + + + 0 == 0 + + + + + 0 == y.v + + + 0 == 0 + + + + @@ -2180,25 +2199,6 @@ Nor would this - - - - y.v == 0 - - - 0 == 0 - - - - - 0 == y.v - - - 0 == 0 - - - - a := 1 diff --git a/projects/SelfTest/UsageTests/Compilation.tests.cpp b/projects/SelfTest/UsageTests/Compilation.tests.cpp index 7f2ad8bc..11d136a4 100644 --- a/projects/SelfTest/UsageTests/Compilation.tests.cpp +++ b/projects/SelfTest/UsageTests/Compilation.tests.cpp @@ -194,6 +194,31 @@ namespace { namespace CompilationTests { REQUIRE(std::is_same, TypeList>::value); } + // #925 + using signal_t = void (*) (void*); + + struct TestClass { + signal_t testMethod_uponComplete_arg = nullptr; + }; + + namespace utility { + inline static void synchronizing_callback( void * ) { } + } + + TEST_CASE("#925: comparing function pointer to function address failed to compile", "[!nonportable]" ) { + TestClass test; + REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg); + } + + TEST_CASE( "#1027: Bitfields can be captured" ) { + struct Y { + uint32_t v : 1; + }; + Y y{ 0 }; + REQUIRE( y.v == 0 ); + REQUIRE( 0 == y.v ); + } + + }} // namespace CompilationTests - diff --git a/projects/SelfTest/UsageTests/Misc.tests.cpp b/projects/SelfTest/UsageTests/Misc.tests.cpp index 00a897d2..0a053ba6 100644 --- a/projects/SelfTest/UsageTests/Misc.tests.cpp +++ b/projects/SelfTest/UsageTests/Misc.tests.cpp @@ -440,12 +440,6 @@ TEST_CASE( "long long" ) { REQUIRE( l == std::numeric_limits::max() ); } -//TEST_CASE( "Divide by Zero signal handler", "[.][sig]" ) { -// int i = 0; -// int x = 10/i; // This should cause the signal to fire -// CHECK( x == 0 ); -//} - TEST_CASE( "This test 'should' fail but doesn't", "[.][failing][!shouldfail]" ) { SUCCEED( "oops!" ); } diff --git a/projects/SelfTest/UsageTests/Tricky.tests.cpp b/projects/SelfTest/UsageTests/Tricky.tests.cpp index ea507a88..d8e5465b 100644 --- a/projects/SelfTest/UsageTests/Tricky.tests.cpp +++ b/projects/SelfTest/UsageTests/Tricky.tests.cpp @@ -402,32 +402,6 @@ TEST_CASE( "non-copyable objects", "[.][failing]" ) { CHECK( ti == typeid(int) ); } -// #925 -using signal_t = void (*) (void*); - -struct TestClass { - signal_t testMethod_uponComplete_arg = nullptr; -}; - -namespace utility { - inline static void synchronizing_callback( void * ) { } -} - -TEST_CASE("#925: comparing function pointer to function address failed to compile", "[!nonportable]" ) { - - TestClass test; - REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg); -} - -TEST_CASE( "Bitfields can be captured (#1027)" ) { - struct Y { - uint32_t v : 1; - }; - Y y{ 0 }; - REQUIRE( y.v == 0 ); - REQUIRE( 0 == y.v ); -} - TEST_CASE("#1514: stderr/stdout is not captured in tests aborted by an exception", "[output-capture][regression][.]") { std::cout << "This would not be caught previously\n" << std::flush; std::clog << "Nor would this\n" << std::flush;