diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index 9df8be0d..8da193da 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -155,6 +155,10 @@ Nor would this :test-result: PASS Generators -- simple :test-result: PASS Generators internals :test-result: PASS Greater-than inequalities with different epsilons +:test-result: PASS Hashers with different seed produce different hash with same test case +:test-result: PASS Hashers with same seed produce same hash +:test-result: PASS Hashing different test cases produces different result +:test-result: PASS Hashing test case produces same hash across multiple calls :test-result: FAIL INFO and WARN do not abort tests :test-result: FAIL INFO gets logged on failure :test-result: FAIL INFO gets logged on failure, even if captured before successful assertions @@ -255,8 +259,6 @@ Message from section two :test-result: PASS Test case with one argument :test-result: PASS Test enum bit values :test-result: PASS Test with special, characters "in name -:test-result: PASS TestCaseInfoHasher produces different hashes. -:test-result: PASS TestCaseInfoHasher produces equal hashes. :test-result: PASS Testing checked-if :test-result: XFAIL Testing checked-if 2 :test-result: XFAIL Testing checked-if 3 diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt index 10db54cd..c95a970d 100644 --- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -153,6 +153,10 @@ :test-result: PASS Generators -- simple :test-result: PASS Generators internals :test-result: PASS Greater-than inequalities with different epsilons +:test-result: PASS Hashers with different seed produce different hash with same test case +:test-result: PASS Hashers with same seed produce same hash +:test-result: PASS Hashing different test cases produces different result +:test-result: PASS Hashing test case produces same hash across multiple calls :test-result: FAIL INFO and WARN do not abort tests :test-result: FAIL INFO gets logged on failure :test-result: FAIL INFO gets logged on failure, even if captured before successful assertions @@ -248,8 +252,6 @@ :test-result: PASS Test case with one argument :test-result: PASS Test enum bit values :test-result: PASS Test with special, characters "in name -:test-result: PASS TestCaseInfoHasher produces different hashes. -:test-result: PASS TestCaseInfoHasher produces equal hashes. :test-result: PASS Testing checked-if :test-result: XFAIL Testing checked-if 2 :test-result: XFAIL Testing checked-if 3 diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 8b404c58..f8c74732 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -916,6 +916,24 @@ Approx.tests.cpp:: passed: d >= Approx( 1.22 ) for: 1.23 >= Approx( Approx.tests.cpp:: passed: d >= Approx( 1.23 ) for: 1.23 >= Approx( 1.23 ) Approx.tests.cpp:: passed: !(d >= Approx( 1.24 )) for: !(1.23 >= Approx( 1.24 )) Approx.tests.cpp:: passed: d >= Approx( 1.24 ).epsilon(0.1) for: 1.23 >= Approx( 1.24 ) +TestCaseInfoHasher.tests.cpp:: passed: h1( dummy ) != h2( dummy ) for: 3422778688 (0x) +!= +130711275 (0x) +TestCaseInfoHasher.tests.cpp:: passed: h1( dummy ) == h2( dummy ) for: 3422778688 (0x) +== +3422778688 (0x) +TestCaseInfoHasher.tests.cpp:: passed: h( dummy1 ) != h( dummy2 ) for: 2903002874 (0x) +!= +2668622104 (0x) +TestCaseInfoHasher.tests.cpp:: passed: h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x) +!= +3916075712 (0x) +TestCaseInfoHasher.tests.cpp:: passed: h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x) +!= +3429949824 (0x) +TestCaseInfoHasher.tests.cpp:: passed: h( dummy ) == h( dummy ) for: 3422778688 (0x) +== +3422778688 (0x) Message.tests.cpp:: warning: 'this is a message' with 1 message: 'this is a warning' Message.tests.cpp:: failed: a == 1 for: 2 == 1 with 2 messages: 'this message should be logged' and 'so should this' Message.tests.cpp:: passed: a == 2 for: 2 == 2 with 1 message: 'this message may be logged later' @@ -1868,21 +1886,6 @@ Tag.tests.cpp:: passed: testCase.tags[0] == Tag( "tag1" ) for: {?} VariadicMacros.tests.cpp:: passed: with 1 message: 'no assertions' Tricky.tests.cpp:: passed: 0x == bit30and31 for: 3221225472 (0x) == 3221225472 CmdLine.tests.cpp:: passed: -TestCaseInfoHasher.tests.cpp:: passed: hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 764519552 (0x) -!= -3472848544 (0x) -TestCaseInfoHasher.tests.cpp:: passed: hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 869111496 (0x) -!= -2870097333 (0x) -TestCaseInfoHasher.tests.cpp:: passed: hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 1172537240 (0x) -!= -1403724645 (0x) -TestCaseInfoHasher.tests.cpp:: passed: h1(testCase1) != h2(testCase2) for: 1836497244 (0x) -!= -430288597 (0x) -TestCaseInfoHasher.tests.cpp:: passed: hasherWithCustomSeed(testCase1) == hasherWithCustomSeed(testCase2) for: 764519552 (0x) -== -764519552 (0x) Misc.tests.cpp:: passed: true Misc.tests.cpp:: passed: Misc.tests.cpp:: failed - but was ok: false diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 3b3e1eef..b9bfabd0 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -914,6 +914,24 @@ Approx.tests.cpp:: passed: d >= Approx( 1.22 ) for: 1.23 >= Approx( Approx.tests.cpp:: passed: d >= Approx( 1.23 ) for: 1.23 >= Approx( 1.23 ) Approx.tests.cpp:: passed: !(d >= Approx( 1.24 )) for: !(1.23 >= Approx( 1.24 )) Approx.tests.cpp:: passed: d >= Approx( 1.24 ).epsilon(0.1) for: 1.23 >= Approx( 1.24 ) +TestCaseInfoHasher.tests.cpp:: passed: h1( dummy ) != h2( dummy ) for: 3422778688 (0x) +!= +130711275 (0x) +TestCaseInfoHasher.tests.cpp:: passed: h1( dummy ) == h2( dummy ) for: 3422778688 (0x) +== +3422778688 (0x) +TestCaseInfoHasher.tests.cpp:: passed: h( dummy1 ) != h( dummy2 ) for: 2903002874 (0x) +!= +2668622104 (0x) +TestCaseInfoHasher.tests.cpp:: passed: h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x) +!= +3916075712 (0x) +TestCaseInfoHasher.tests.cpp:: passed: h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x) +!= +3429949824 (0x) +TestCaseInfoHasher.tests.cpp:: passed: h( dummy ) == h( dummy ) for: 3422778688 (0x) +== +3422778688 (0x) Message.tests.cpp:: warning: 'this is a message' with 1 message: 'this is a warning' Message.tests.cpp:: failed: a == 1 for: 2 == 1 with 2 messages: 'this message should be logged' and 'so should this' Message.tests.cpp:: passed: a == 2 for: 2 == 2 with 1 message: 'this message may be logged later' @@ -1861,21 +1879,6 @@ Tag.tests.cpp:: passed: testCase.tags[0] == Tag( "tag1" ) for: {?} VariadicMacros.tests.cpp:: passed: with 1 message: 'no assertions' Tricky.tests.cpp:: passed: 0x == bit30and31 for: 3221225472 (0x) == 3221225472 CmdLine.tests.cpp:: passed: -TestCaseInfoHasher.tests.cpp:: passed: hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 764519552 (0x) -!= -3472848544 (0x) -TestCaseInfoHasher.tests.cpp:: passed: hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 869111496 (0x) -!= -2870097333 (0x) -TestCaseInfoHasher.tests.cpp:: passed: hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 1172537240 (0x) -!= -1403724645 (0x) -TestCaseInfoHasher.tests.cpp:: passed: h1(testCase1) != h2(testCase2) for: 1836497244 (0x) -!= -430288597 (0x) -TestCaseInfoHasher.tests.cpp:: passed: hasherWithCustomSeed(testCase1) == hasherWithCustomSeed(testCase2) for: 764519552 (0x) -== -764519552 (0x) Misc.tests.cpp:: passed: true Misc.tests.cpp:: passed: Misc.tests.cpp:: failed - but was ok: false diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 61b1a112..a6847cdf 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1395,6 +1395,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 388 | 312 passed | 69 failed | 7 failed as expected -assertions: 2224 | 2069 passed | 128 failed | 27 failed as expected +test cases: 390 | 314 passed | 69 failed | 7 failed as expected +assertions: 2225 | 2070 passed | 128 failed | 27 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 148a3b53..d3476456 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -6832,6 +6832,87 @@ Approx.tests.cpp:: PASSED: with expansion: 1.23 >= Approx( 1.24 ) +------------------------------------------------------------------------------- +Hashers with different seed produce different hash with same test case +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h1( dummy ) != h2( dummy ) ) +with expansion: + 3422778688 (0x) + != + 130711275 (0x) + +------------------------------------------------------------------------------- +Hashers with same seed produce same hash +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h1( dummy ) == h2( dummy ) ) +with expansion: + 3422778688 (0x) + == + 3422778688 (0x) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different test name +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2903002874 (0x) + != + 2668622104 (0x) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different classname +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2673152918 (0x) + != + 3916075712 (0x) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different tags +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2074929312 (0x) + != + 3429949824 (0x) + +------------------------------------------------------------------------------- +Hashing test case produces same hash across multiple calls +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h( dummy ) == h( dummy ) ) +with expansion: + 3422778688 (0x) + == + 3422778688 (0x) + ------------------------------------------------------------------------------- INFO and WARN do not abort tests ------------------------------------------------------------------------------- @@ -13286,76 +13367,6 @@ CmdLine.tests.cpp: CmdLine.tests.cpp:: PASSED: -------------------------------------------------------------------------------- -TestCaseInfoHasher produces different hashes. - class names are equal, names are equal but tags are different. -------------------------------------------------------------------------------- -TestCaseInfoHasher.tests.cpp: -............................................................................... - -TestCaseInfoHasher.tests.cpp:: PASSED: - CHECK( hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) ) -with expansion: - 764519552 (0x) - != - 3472848544 (0x) - -------------------------------------------------------------------------------- -TestCaseInfoHasher produces different hashes. - class names are equal, tags are equal but names are different -------------------------------------------------------------------------------- -TestCaseInfoHasher.tests.cpp: -............................................................................... - -TestCaseInfoHasher.tests.cpp:: PASSED: - CHECK( hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) ) -with expansion: - 869111496 (0x) - != - 2870097333 (0x) - -------------------------------------------------------------------------------- -TestCaseInfoHasher produces different hashes. - names are equal, tags are equal but class names are different -------------------------------------------------------------------------------- -TestCaseInfoHasher.tests.cpp: -............................................................................... - -TestCaseInfoHasher.tests.cpp:: PASSED: - CHECK( hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) ) -with expansion: - 1172537240 (0x) - != - 1403724645 (0x) - -------------------------------------------------------------------------------- -TestCaseInfoHasher produces different hashes. - class names and names and tags are equal but hashers are seeded differently. -------------------------------------------------------------------------------- -TestCaseInfoHasher.tests.cpp: -............................................................................... - -TestCaseInfoHasher.tests.cpp:: PASSED: - CHECK( h1(testCase1) != h2(testCase2) ) -with expansion: - 1836497244 (0x) - != - 430288597 (0x) - -------------------------------------------------------------------------------- -TestCaseInfoHasher produces equal hashes. - class names and names and tags are equal. -------------------------------------------------------------------------------- -TestCaseInfoHasher.tests.cpp: -............................................................................... - -TestCaseInfoHasher.tests.cpp:: PASSED: - CHECK( hasherWithCustomSeed(testCase1) == hasherWithCustomSeed(testCase2) ) -with expansion: - 764519552 (0x) - == - 764519552 (0x) - ------------------------------------------------------------------------------- Testing checked-if ------------------------------------------------------------------------------- @@ -17941,6 +17952,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 388 | 298 passed | 83 failed | 7 failed as expected -assertions: 2239 | 2069 passed | 143 failed | 27 failed as expected +test cases: 390 | 300 passed | 83 failed | 7 failed as expected +assertions: 2240 | 2070 passed | 143 failed | 27 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index 412303da..3cfef5e2 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -6830,6 +6830,87 @@ Approx.tests.cpp:: PASSED: with expansion: 1.23 >= Approx( 1.24 ) +------------------------------------------------------------------------------- +Hashers with different seed produce different hash with same test case +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h1( dummy ) != h2( dummy ) ) +with expansion: + 3422778688 (0x) + != + 130711275 (0x) + +------------------------------------------------------------------------------- +Hashers with same seed produce same hash +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h1( dummy ) == h2( dummy ) ) +with expansion: + 3422778688 (0x) + == + 3422778688 (0x) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different test name +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2903002874 (0x) + != + 2668622104 (0x) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different classname +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2673152918 (0x) + != + 3916075712 (0x) + +------------------------------------------------------------------------------- +Hashing different test cases produces different result + Different tags +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h( dummy1 ) != h( dummy2 ) ) +with expansion: + 2074929312 (0x) + != + 3429949824 (0x) + +------------------------------------------------------------------------------- +Hashing test case produces same hash across multiple calls +------------------------------------------------------------------------------- +TestCaseInfoHasher.tests.cpp: +............................................................................... + +TestCaseInfoHasher.tests.cpp:: PASSED: + REQUIRE( h( dummy ) == h( dummy ) ) +with expansion: + 3422778688 (0x) + == + 3422778688 (0x) + ------------------------------------------------------------------------------- INFO and WARN do not abort tests ------------------------------------------------------------------------------- @@ -13279,76 +13360,6 @@ CmdLine.tests.cpp: CmdLine.tests.cpp:: PASSED: -------------------------------------------------------------------------------- -TestCaseInfoHasher produces different hashes. - class names are equal, names are equal but tags are different. -------------------------------------------------------------------------------- -TestCaseInfoHasher.tests.cpp: -............................................................................... - -TestCaseInfoHasher.tests.cpp:: PASSED: - CHECK( hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) ) -with expansion: - 764519552 (0x) - != - 3472848544 (0x) - -------------------------------------------------------------------------------- -TestCaseInfoHasher produces different hashes. - class names are equal, tags are equal but names are different -------------------------------------------------------------------------------- -TestCaseInfoHasher.tests.cpp: -............................................................................... - -TestCaseInfoHasher.tests.cpp:: PASSED: - CHECK( hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) ) -with expansion: - 869111496 (0x) - != - 2870097333 (0x) - -------------------------------------------------------------------------------- -TestCaseInfoHasher produces different hashes. - names are equal, tags are equal but class names are different -------------------------------------------------------------------------------- -TestCaseInfoHasher.tests.cpp: -............................................................................... - -TestCaseInfoHasher.tests.cpp:: PASSED: - CHECK( hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) ) -with expansion: - 1172537240 (0x) - != - 1403724645 (0x) - -------------------------------------------------------------------------------- -TestCaseInfoHasher produces different hashes. - class names and names and tags are equal but hashers are seeded differently. -------------------------------------------------------------------------------- -TestCaseInfoHasher.tests.cpp: -............................................................................... - -TestCaseInfoHasher.tests.cpp:: PASSED: - CHECK( h1(testCase1) != h2(testCase2) ) -with expansion: - 1836497244 (0x) - != - 430288597 (0x) - -------------------------------------------------------------------------------- -TestCaseInfoHasher produces equal hashes. - class names and names and tags are equal. -------------------------------------------------------------------------------- -TestCaseInfoHasher.tests.cpp: -............................................................................... - -TestCaseInfoHasher.tests.cpp:: PASSED: - CHECK( hasherWithCustomSeed(testCase1) == hasherWithCustomSeed(testCase2) ) -with expansion: - 764519552 (0x) - == - 764519552 (0x) - ------------------------------------------------------------------------------- Testing checked-if ------------------------------------------------------------------------------- @@ -17933,6 +17944,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 388 | 298 passed | 83 failed | 7 failed as expected -assertions: 2239 | 2069 passed | 143 failed | 27 failed as expected +test cases: 390 | 300 passed | 83 failed | 7 failed as expected +assertions: 2240 | 2070 passed | 143 failed | 27 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 7c82e5b3..519fdfbc 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -728,6 +728,12 @@ Message.tests.cpp: + + + + + + @@ -1355,11 +1361,6 @@ Misc.tests.cpp: - - - - - diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index d850f16a..567b7ab7 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -1,6 +1,6 @@ - + @@ -727,6 +727,12 @@ Message.tests.cpp: + + + + + + @@ -1354,11 +1360,6 @@ Misc.tests.cpp: - - - - - diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index 1a9d215d..6d41d95b 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -274,11 +274,12 @@ - - - - - + + + + + + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index cbefb063..7f2f076b 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -273,11 +273,12 @@ - - - - - + + + + + + diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 67ceddfc..d7d9a9cf 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -1766,6 +1766,18 @@ ok {test-number} - d >= Approx( 1.23 ) for: 1.23 >= Approx( 1.23 ) ok {test-number} - !(d >= Approx( 1.24 )) for: !(1.23 >= Approx( 1.24 )) # Greater-than inequalities with different epsilons ok {test-number} - d >= Approx( 1.24 ).epsilon(0.1) for: 1.23 >= Approx( 1.24 ) +# Hashers with different seed produce different hash with same test case +ok {test-number} - h1( dummy ) != h2( dummy ) for: 3422778688 (0x) != 130711275 (0x) +# Hashers with same seed produce same hash +ok {test-number} - h1( dummy ) == h2( dummy ) for: 3422778688 (0x) == 3422778688 (0x) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2903002874 (0x) != 2668622104 (0x) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x) != 3916075712 (0x) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x) != 3429949824 (0x) +# Hashing test case produces same hash across multiple calls +ok {test-number} - h( dummy ) == h( dummy ) for: 3422778688 (0x) == 3422778688 (0x) # INFO and WARN do not abort tests warning {test-number} - 'this is a message' with 1 message: 'this is a warning' # INFO gets logged on failure @@ -3297,16 +3309,6 @@ ok {test-number} - with 1 message: 'no assertions' ok {test-number} - 0x == bit30and31 for: 3221225472 (0x) == 3221225472 # Test with special, characters "in name ok {test-number} - -# TestCaseInfoHasher produces different hashes. -ok {test-number} - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 764519552 (0x) != 3472848544 (0x) -# TestCaseInfoHasher produces different hashes. -ok {test-number} - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 869111496 (0x) != 2870097333 (0x) -# TestCaseInfoHasher produces different hashes. -ok {test-number} - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 1172537240 (0x) != 1403724645 (0x) -# TestCaseInfoHasher produces different hashes. -ok {test-number} - h1(testCase1) != h2(testCase2) for: 1836497244 (0x) != 430288597 (0x) -# TestCaseInfoHasher produces equal hashes. -ok {test-number} - hasherWithCustomSeed(testCase1) == hasherWithCustomSeed(testCase2) for: 764519552 (0x) == 764519552 (0x) # Testing checked-if ok {test-number} - true # Testing checked-if @@ -4480,5 +4482,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2239 +1..2240 diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index d369326e..cf36b3d9 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -1764,6 +1764,18 @@ ok {test-number} - d >= Approx( 1.23 ) for: 1.23 >= Approx( 1.23 ) ok {test-number} - !(d >= Approx( 1.24 )) for: !(1.23 >= Approx( 1.24 )) # Greater-than inequalities with different epsilons ok {test-number} - d >= Approx( 1.24 ).epsilon(0.1) for: 1.23 >= Approx( 1.24 ) +# Hashers with different seed produce different hash with same test case +ok {test-number} - h1( dummy ) != h2( dummy ) for: 3422778688 (0x) != 130711275 (0x) +# Hashers with same seed produce same hash +ok {test-number} - h1( dummy ) == h2( dummy ) for: 3422778688 (0x) == 3422778688 (0x) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2903002874 (0x) != 2668622104 (0x) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2673152918 (0x) != 3916075712 (0x) +# Hashing different test cases produces different result +ok {test-number} - h( dummy1 ) != h( dummy2 ) for: 2074929312 (0x) != 3429949824 (0x) +# Hashing test case produces same hash across multiple calls +ok {test-number} - h( dummy ) == h( dummy ) for: 3422778688 (0x) == 3422778688 (0x) # INFO and WARN do not abort tests warning {test-number} - 'this is a message' with 1 message: 'this is a warning' # INFO gets logged on failure @@ -3290,16 +3302,6 @@ ok {test-number} - with 1 message: 'no assertions' ok {test-number} - 0x == bit30and31 for: 3221225472 (0x) == 3221225472 # Test with special, characters "in name ok {test-number} - -# TestCaseInfoHasher produces different hashes. -ok {test-number} - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 764519552 (0x) != 3472848544 (0x) -# TestCaseInfoHasher produces different hashes. -ok {test-number} - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 869111496 (0x) != 2870097333 (0x) -# TestCaseInfoHasher produces different hashes. -ok {test-number} - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) for: 1172537240 (0x) != 1403724645 (0x) -# TestCaseInfoHasher produces different hashes. -ok {test-number} - h1(testCase1) != h2(testCase2) for: 1836497244 (0x) != 430288597 (0x) -# TestCaseInfoHasher produces equal hashes. -ok {test-number} - hasherWithCustomSeed(testCase1) == hasherWithCustomSeed(testCase2) for: 764519552 (0x) == 764519552 (0x) # Testing checked-if ok {test-number} - true # Testing checked-if @@ -4472,5 +4474,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2239 +1..2240 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index d9b98f70..2ef7d121 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -377,6 +377,14 @@ Message.tests.cpp:|nexplicit failure with message:|n "This is a fa ##teamcity[testFinished name='Generators internals' duration="{duration}"] ##teamcity[testStarted name='Greater-than inequalities with different epsilons'] ##teamcity[testFinished name='Greater-than inequalities with different epsilons' duration="{duration}"] +##teamcity[testStarted name='Hashers with different seed produce different hash with same test case'] +##teamcity[testFinished name='Hashers with different seed produce different hash with same test case' duration="{duration}"] +##teamcity[testStarted name='Hashers with same seed produce same hash'] +##teamcity[testFinished name='Hashers with same seed produce same hash' duration="{duration}"] +##teamcity[testStarted name='Hashing different test cases produces different result'] +##teamcity[testFinished name='Hashing different test cases produces different result' duration="{duration}"] +##teamcity[testStarted name='Hashing test case produces same hash across multiple calls'] +##teamcity[testFinished name='Hashing test case produces same hash across multiple calls' duration="{duration}"] ##teamcity[testStarted name='INFO and WARN do not abort tests'] ##teamcity[testFinished name='INFO and WARN do not abort tests' duration="{duration}"] ##teamcity[testStarted name='INFO gets logged on failure'] @@ -615,10 +623,6 @@ Misc.tests.cpp:|nexpression failed|n CHECK( s1 == s2 )|nwith expan ##teamcity[testFinished name='Test enum bit values' duration="{duration}"] ##teamcity[testStarted name='Test with special, characters "in name'] ##teamcity[testFinished name='Test with special, characters "in name' duration="{duration}"] -##teamcity[testStarted name='TestCaseInfoHasher produces different hashes.'] -##teamcity[testFinished name='TestCaseInfoHasher produces different hashes.' duration="{duration}"] -##teamcity[testStarted name='TestCaseInfoHasher produces equal hashes.'] -##teamcity[testFinished name='TestCaseInfoHasher produces equal hashes.' duration="{duration}"] ##teamcity[testStarted name='Testing checked-if'] ##teamcity[testFinished name='Testing checked-if' duration="{duration}"] ##teamcity[testStarted name='Testing checked-if 2'] diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index ffdae89c..4edcdab5 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -377,6 +377,14 @@ Message.tests.cpp:|nexplicit failure with message:|n "This is a fa ##teamcity[testFinished name='Generators internals' duration="{duration}"] ##teamcity[testStarted name='Greater-than inequalities with different epsilons'] ##teamcity[testFinished name='Greater-than inequalities with different epsilons' duration="{duration}"] +##teamcity[testStarted name='Hashers with different seed produce different hash with same test case'] +##teamcity[testFinished name='Hashers with different seed produce different hash with same test case' duration="{duration}"] +##teamcity[testStarted name='Hashers with same seed produce same hash'] +##teamcity[testFinished name='Hashers with same seed produce same hash' duration="{duration}"] +##teamcity[testStarted name='Hashing different test cases produces different result'] +##teamcity[testFinished name='Hashing different test cases produces different result' duration="{duration}"] +##teamcity[testStarted name='Hashing test case produces same hash across multiple calls'] +##teamcity[testFinished name='Hashing test case produces same hash across multiple calls' duration="{duration}"] ##teamcity[testStarted name='INFO and WARN do not abort tests'] ##teamcity[testFinished name='INFO and WARN do not abort tests' duration="{duration}"] ##teamcity[testStarted name='INFO gets logged on failure'] @@ -615,10 +623,6 @@ Misc.tests.cpp:|nexpression failed|n CHECK( s1 == s2 )|nwith expan ##teamcity[testFinished name='Test enum bit values' duration="{duration}"] ##teamcity[testStarted name='Test with special, characters "in name'] ##teamcity[testFinished name='Test with special, characters "in name' duration="{duration}"] -##teamcity[testStarted name='TestCaseInfoHasher produces different hashes.'] -##teamcity[testFinished name='TestCaseInfoHasher produces different hashes.' duration="{duration}"] -##teamcity[testStarted name='TestCaseInfoHasher produces equal hashes.'] -##teamcity[testFinished name='TestCaseInfoHasher produces equal hashes.' duration="{duration}"] ##teamcity[testStarted name='Testing checked-if'] ##teamcity[testFinished name='Testing checked-if' duration="{duration}"] ##teamcity[testStarted name='Testing checked-if 2'] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 4facaec2..79245e38 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -8221,6 +8221,87 @@ C + + + + h1( dummy ) != h2( dummy ) + + + 3422778688 (0x) +!= +130711275 (0x) + + + + + + + + h1( dummy ) == h2( dummy ) + + + 3422778688 (0x) +== +3422778688 (0x) + + + + + +
+ + + h( dummy1 ) != h( dummy2 ) + + + 2903002874 (0x) +!= +2668622104 (0x) + + + +
+
+ + + h( dummy1 ) != h( dummy2 ) + + + 2673152918 (0x) +!= +3916075712 (0x) + + + +
+
+ + + h( dummy1 ) != h( dummy2 ) + + + 2074929312 (0x) +!= +3429949824 (0x) + + + +
+ +
+ + + + h( dummy ) == h( dummy ) + + + 3422778688 (0x) +== +3422778688 (0x) + + + + this is a message @@ -15579,77 +15660,6 @@ Message from section two - -
- - - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) - - - 764519552 (0x) -!= -3472848544 (0x) - - - -
-
- - - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) - - - 869111496 (0x) -!= -2870097333 (0x) - - - -
-
- - - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) - - - 1172537240 (0x) -!= -1403724645 (0x) - - - -
-
- - - h1(testCase1) != h2(testCase2) - - - 1836497244 (0x) -!= -430288597 (0x) - - - -
- -
- -
- - - hasherWithCustomSeed(testCase1) == hasherWithCustomSeed(testCase2) - - - 764519552 (0x) -== -764519552 (0x) - - - -
- -
@@ -21062,6 +21072,6 @@ loose text artifact - - + + diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index f6b172f5..2daf4989 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -8221,6 +8221,87 @@ C
+ + + + h1( dummy ) != h2( dummy ) + + + 3422778688 (0x) +!= +130711275 (0x) + + + + + + + + h1( dummy ) == h2( dummy ) + + + 3422778688 (0x) +== +3422778688 (0x) + + + + + +
+ + + h( dummy1 ) != h( dummy2 ) + + + 2903002874 (0x) +!= +2668622104 (0x) + + + +
+
+ + + h( dummy1 ) != h( dummy2 ) + + + 2673152918 (0x) +!= +3916075712 (0x) + + + +
+
+ + + h( dummy1 ) != h( dummy2 ) + + + 2074929312 (0x) +!= +3429949824 (0x) + + + +
+ +
+ + + + h( dummy ) == h( dummy ) + + + 3422778688 (0x) +== +3422778688 (0x) + + + + this is a message @@ -15579,77 +15660,6 @@ Message from section two - -
- - - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) - - - 764519552 (0x) -!= -3472848544 (0x) - - - -
-
- - - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) - - - 869111496 (0x) -!= -2870097333 (0x) - - - -
-
- - - hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2) - - - 1172537240 (0x) -!= -1403724645 (0x) - - - -
-
- - - h1(testCase1) != h2(testCase2) - - - 1836497244 (0x) -!= -430288597 (0x) - - - -
- -
- -
- - - hasherWithCustomSeed(testCase1) == hasherWithCustomSeed(testCase2) - - - 764519552 (0x) -== -764519552 (0x) - - - -
- -
@@ -21061,6 +21071,6 @@ There is no extra whitespace here - - + + diff --git a/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp b/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp index a3c1d651..93cb70b1 100644 --- a/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp @@ -12,48 +12,61 @@ static constexpr Catch::SourceLineInfo dummySourceLineInfo = CATCH_INTERNAL_LINEINFO; -TEST_CASE( "TestCaseInfoHasher produces equal hashes." ) { - SECTION( "class names and names and tags are equal." ) { - Catch::TestCaseInfo testCase1("", {"name", "[.magic-tag1]"}, dummySourceLineInfo); - Catch::TestCaseInfo testCase2("", {"name", "[.magic-tag1]"}, dummySourceLineInfo); +using Catch::TestCaseInfo; +using Catch::TestCaseInfoHasher; - Catch::TestCaseInfoHasher hasherWithCustomSeed(123456789u); - CHECK(hasherWithCustomSeed(testCase1) == hasherWithCustomSeed(testCase2)); - } +TEST_CASE("Hashers with same seed produce same hash", "[test-case-hash]") { + TestCaseInfo dummy( "", { "name", "[a-tag]" }, dummySourceLineInfo ); + + TestCaseInfoHasher h1( 0x12345678 ); + TestCaseInfoHasher h2( 0x12345678 ); + + REQUIRE( h1( dummy ) == h2( dummy ) ); } -TEST_CASE( "TestCaseInfoHasher produces different hashes." ) { - SECTION( "class names are equal, names are equal but tags are different." ) { - Catch::TestCaseInfo testCase1("", {"name", "[.magic-tag1]"}, dummySourceLineInfo); - Catch::TestCaseInfo testCase2("", {"name", "[.magic-tag2]"}, dummySourceLineInfo); +TEST_CASE( + "Hashers with different seed produce different hash with same test case", + "[test-case-hash]") { + TestCaseInfo dummy( "", { "name", "[a-tag]" }, dummySourceLineInfo ); - Catch::TestCaseInfoHasher hasherWithCustomSeed(123456789u); - CHECK(hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2)); + TestCaseInfoHasher h1( 0x12345678 ); + TestCaseInfoHasher h2( 0x87654321 ); + + REQUIRE( h1( dummy ) != h2( dummy ) ); +} + +TEST_CASE("Hashing test case produces same hash across multiple calls", + "[test-case-hash]") { + TestCaseInfo dummy( "", { "name", "[a-tag]" }, dummySourceLineInfo ); + + TestCaseInfoHasher h( 0x12345678 ); + + REQUIRE( h( dummy ) == h( dummy ) ); +} + +TEST_CASE("Hashing different test cases produces different result", "[test-case-hash]") { + TestCaseInfoHasher h( 0x12345678 ); + SECTION("Different test name") { + TestCaseInfo dummy1( "class", { "name-1", "[a-tag]" }, dummySourceLineInfo ); + TestCaseInfo dummy2( + "class", { "name-2", "[a-tag]" }, dummySourceLineInfo ); + + REQUIRE( h( dummy1 ) != h( dummy2 ) ); } + SECTION("Different classname") { + TestCaseInfo dummy1( + "class-1", { "name", "[a-tag]" }, dummySourceLineInfo ); + TestCaseInfo dummy2( + "class-2", { "name", "[a-tag]" }, dummySourceLineInfo ); - SECTION( "class names are equal, tags are equal but names are different" ) { - Catch::TestCaseInfo testCase1("", {"name1", "[.magic-tag]"}, dummySourceLineInfo); - Catch::TestCaseInfo testCase2("", {"name2", "[.magic-tag]"}, dummySourceLineInfo); - - Catch::TestCaseInfoHasher hasherWithCustomSeed(123456789u); - CHECK(hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2)); + REQUIRE( h( dummy1 ) != h( dummy2 ) ); } + SECTION("Different tags") { + TestCaseInfo dummy1( + "class", { "name", "[a-tag]" }, dummySourceLineInfo ); + TestCaseInfo dummy2( + "class", { "name", "[b-tag]" }, dummySourceLineInfo ); - SECTION( "names are equal, tags are equal but class names are different" ) { - Catch::TestCaseInfo testCase1("class1", {"name", "[.magic-tag]"}, dummySourceLineInfo); - Catch::TestCaseInfo testCase2("class2", {"name", "[.magic-tag]"}, dummySourceLineInfo); - - Catch::TestCaseInfoHasher hasherWithCustomSeed(123456789u); - CHECK(hasherWithCustomSeed(testCase1) != hasherWithCustomSeed(testCase2)); - } - - SECTION( "class names and names and tags are equal but hashers are seeded differently." ) { - Catch::TestCaseInfo testCase1("", {"name", "[.magic-tag1]"}, dummySourceLineInfo); - Catch::TestCaseInfo testCase2("", {"name", "[.magic-tag1]"}, dummySourceLineInfo); - - Catch::TestCaseInfoHasher h1(14695981039346656037u); - Catch::TestCaseInfoHasher h2(14695981039346656038u); - - CHECK(h1(testCase1) != h2(testCase2)); + REQUIRE( h( dummy1 ) != h( dummy2 ) ); } }