mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Small cleanup of self tests
This commit is contained in:
		| @@ -3,6 +3,8 @@ Decomposition.tests.cpp:<line number>: passed: fptr == 0 for: 0 == 0 | ||||
| Decomposition.tests.cpp:<line number>: passed: fptr == 0l for: 0 == 0 | ||||
| Compilation.tests.cpp:<line number>: passed: y.v == 0 for: 0 == 0 | ||||
| Compilation.tests.cpp:<line number>: passed: 0 == y.v for: 0 == 0 | ||||
| Compilation.tests.cpp:<line number>: passed: y.v == 0 for: 0 == 0 | ||||
| Compilation.tests.cpp:<line number>: passed: 0 == y.v for: 0 == 0 | ||||
| Compilation.tests.cpp:<line number>: passed: t1 == t2 for: {?} == {?} | ||||
| Compilation.tests.cpp:<line number>: passed: t1 != t2 for: {?} != {?} | ||||
| Compilation.tests.cpp:<line number>: passed: t1 < t2 for: {?} < {?} | ||||
| @@ -244,8 +246,6 @@ Tricky.tests.cpp:<line number>: passed: true | ||||
| Approx.tests.cpp:<line number>: passed: INFINITY == Approx(INFINITY) for: inff == Approx( inf ) | ||||
| Approx.tests.cpp:<line number>: passed: NAN != Approx(NAN) for: nanf != Approx( nan ) | ||||
| Approx.tests.cpp:<line number>: passed: !(NAN == Approx(NAN)) for: !(nanf == Approx( nan )) | ||||
| Tricky.tests.cpp:<line number>: passed: y.v == 0 for: 0 == 0 | ||||
| Tricky.tests.cpp:<line number>: passed: 0 == y.v for: 0 == 0 | ||||
| Message.tests.cpp:<line number>: 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:<line number>: passed: with 7 messages: 'std::vector<int>{1, 2, 3}[0, 1, 2] := 3' and 'std::vector<int>{1, 2, 3}[(0, 1)] := 2' and 'std::vector<int>{1, 2, 3}[0] := 1' and '(helper_1436<int, int>{12, -12}) := { 12, -12 }' and '(helper_1436<int, int>(-12, 12)) := { -12, 12 }' and '(1, 2) := 2' and '(2, 3) := 3' | ||||
| 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 ''{' := '{'' | ||||
|   | ||||
| @@ -39,6 +39,22 @@ with expansion: | ||||
| Compilation.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Compilation.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( y.v == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| Compilation.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( 0 == y.v ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| #1027: Bitfields can be captured | ||||
| ------------------------------------------------------------------------------- | ||||
| Compilation.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Compilation.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( y.v == 0 ) | ||||
| with expansion: | ||||
| @@ -1944,22 +1960,6 @@ Approx.tests.cpp:<line number>: PASSED: | ||||
| with expansion: | ||||
|   !(nanf == Approx( nan )) | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Bitfields can be captured (#1027) | ||||
| ------------------------------------------------------------------------------- | ||||
| Tricky.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Tricky.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( y.v == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| Tricky.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( 0 == y.v ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| CAPTURE can deal with complex expressions | ||||
| ------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -39,6 +39,22 @@ with expansion: | ||||
| Compilation.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Compilation.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( y.v == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| Compilation.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( 0 == y.v ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| #1027: Bitfields can be captured | ||||
| ------------------------------------------------------------------------------- | ||||
| Compilation.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Compilation.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( y.v == 0 ) | ||||
| with expansion: | ||||
| @@ -352,6 +368,6 @@ Condition.tests.cpp:<line number>: 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 | ||||
|  | ||||
|   | ||||
| @@ -9,6 +9,7 @@ | ||||
|     <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="#1027" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="#1027: Bitfields can be captured" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="#1147" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="#1175 - Hidden Test" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="#1238" time="{duration}"/> | ||||
| @@ -232,7 +233,6 @@ Exception.tests.cpp:<line number> | ||||
|     <testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another section" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another other section" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Assorted miscellaneous tests" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Bitfields can be captured (#1027)" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="CAPTURE can deal with complex expressions" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="CAPTURE can deal with complex expressions involving commas" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="CAPTURE parses string and character constants" time="{duration}"/> | ||||
|   | ||||
| @@ -43,6 +43,25 @@ | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="#1027: Bitfields can be captured" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" > | ||||
|         <Original> | ||||
|           y.v == 0 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" > | ||||
|         <Original> | ||||
|           0 == y.v | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="#1147" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" > | ||||
|         <Original> | ||||
| @@ -2180,25 +2199,6 @@ Nor would this | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="Bitfields can be captured (#1027)" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > | ||||
|         <Original> | ||||
|           y.v == 0 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > | ||||
|         <Original> | ||||
|           0 == y.v | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="CAPTURE can deal with complex expressions" tags="[capture][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > | ||||
|       <Info> | ||||
|         a := 1 | ||||
|   | ||||
| @@ -194,6 +194,31 @@ namespace { namespace CompilationTests { | ||||
|         REQUIRE(std::is_same<TypeList<int>, TypeList<int>>::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 | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -440,12 +440,6 @@ TEST_CASE( "long long" ) { | ||||
|     REQUIRE( l == std::numeric_limits<long long>::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!" ); | ||||
| } | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský