From c8d765a57508e687e117f9c4d32ec2d3c6a8a896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Thu, 15 Feb 2018 16:03:24 +0100 Subject: [PATCH] Cleanup some tests --- .../Baselines/compact.sw.approved.txt | 24 +-- .../Baselines/console.sw.approved.txt | 154 ++++++++--------- .../SelfTest/Baselines/junit.sw.approved.txt | 10 +- .../SelfTest/Baselines/xml.sw.approved.txt | 158 +++++++++--------- .../UsageTests/ToStringWhich.tests.cpp | 15 +- 5 files changed, 179 insertions(+), 182 deletions(-) diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt index 5569efd6..f8b5b888 100644 --- a/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -982,6 +982,14 @@ ToStringPair.tests.cpp:: passed: ::Catch::Detail::stringify( pr ) = == "{ { "green", 55 } }" Tricky.tests.cpp:: failed: std::string( "first" ) == "second" for: "first" == "second" +ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" +== +"op<<(streamable_range)" +ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" for: "stringmaker(streamable_range)" +== +"stringmaker(streamable_range)" +ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" for: "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" +ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(disabled_range{}) == "{ !!! }" for: "{ !!! }" == "{ !!! }" ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify( item ) == "StringMaker" for: "StringMaker" == "StringMaker" @@ -992,18 +1000,6 @@ ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(item) ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" for: "operator<<( has_operator )" == "operator<<( has_operator )" -Misc.tests.cpp:: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load"" -Misc.tests.cpp:: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load"" -Misc.tests.cpp:: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load"" -Misc.tests.cpp:: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load"" -ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" -== -"op<<(streamable_range)" -ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" for: "stringmaker(streamable_range)" -== -"stringmaker(streamable_range)" -ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" for: "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" -ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(disabled_range{}) == "{ !!! }" for: "{ !!! }" == "{ !!! }" ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify( v ) == "{ StringMaker }" for: "{ StringMaker }" == "{ StringMaker }" @@ -1013,6 +1009,10 @@ ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify( v ) = ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" for: "{ operator<<( has_operator ) }" == "{ operator<<( has_operator ) }" +Misc.tests.cpp:: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load"" +Misc.tests.cpp:: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load"" +Misc.tests.cpp:: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load"" +Misc.tests.cpp:: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load"" EnumToString.tests.cpp:: passed: ::Catch::Detail::stringify(e0) == "E2/V0" for: "E2/V0" == "E2/V0" EnumToString.tests.cpp:: passed: ::Catch::Detail::stringify(e1) == "E2/V1" for: "E2/V1" == "E2/V1" EnumToString.tests.cpp:: passed: ::Catch::Detail::stringify(e3) == "Unknown enum value 10" for: "Unknown enum value 10" diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index c1f1161e..0bac931d 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -7862,6 +7862,40 @@ Tricky.tests.cpp:: FAILED: with expansion: "first" == "second" +------------------------------------------------------------------------------- +stringify ranges +------------------------------------------------------------------------------- +ToStringWhich.tests.cpp: +............................................................................... + +ToStringWhich.tests.cpp:: +PASSED: + REQUIRE( ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" ) +with expansion: + "op<<(streamable_range)" + == + "op<<(streamable_range)" + +ToStringWhich.tests.cpp:: +PASSED: + REQUIRE( ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" ) +with expansion: + "stringmaker(streamable_range)" + == + "stringmaker(streamable_range)" + +ToStringWhich.tests.cpp:: +PASSED: + REQUIRE( ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" ) +with expansion: + "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" + +ToStringWhich.tests.cpp:: +PASSED: + REQUIRE( ::Catch::Detail::stringify(disabled_range{}) == "{ !!! }" ) +with expansion: + "{ !!! }" == "{ !!! }" + ------------------------------------------------------------------------------- stringify( has_maker ) ------------------------------------------------------------------------------- @@ -7877,7 +7911,7 @@ with expansion: "StringMaker" ------------------------------------------------------------------------------- -stringify( has_maker_and_toString ) +stringify( has_maker_and_operator ) ------------------------------------------------------------------------------- ToStringWhich.tests.cpp: ............................................................................... @@ -7916,6 +7950,48 @@ with expansion: == "operator<<( has_operator )" +------------------------------------------------------------------------------- +stringify( vectors ) +------------------------------------------------------------------------------- +ToStringWhich.tests.cpp: +............................................................................... + +ToStringWhich.tests.cpp:: +PASSED: + REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker }" ) +with expansion: + "{ StringMaker }" + == + "{ StringMaker }" + +------------------------------------------------------------------------------- +stringify( vectors ) +------------------------------------------------------------------------------- +ToStringWhich.tests.cpp: +............................................................................... + +ToStringWhich.tests.cpp:: +PASSED: + REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker }" ) +with expansion: + "{ StringMaker }" + == + "{ StringMaker }" + +------------------------------------------------------------------------------- +stringify( vectors ) +------------------------------------------------------------------------------- +ToStringWhich.tests.cpp: +............................................................................... + +ToStringWhich.tests.cpp:: +PASSED: + REQUIRE( ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" ) +with expansion: + "{ operator<<( has_operator ) }" + == + "{ operator<<( has_operator ) }" + ------------------------------------------------------------------------------- toString on const wchar_t const pointer returns the string contents ------------------------------------------------------------------------------- @@ -7964,82 +8040,6 @@ PASSED: with expansion: ""wide load"" == ""wide load"" -------------------------------------------------------------------------------- -toString streamable range -------------------------------------------------------------------------------- -ToStringWhich.tests.cpp: -............................................................................... - -ToStringWhich.tests.cpp:: -PASSED: - REQUIRE( ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" ) -with expansion: - "op<<(streamable_range)" - == - "op<<(streamable_range)" - -ToStringWhich.tests.cpp:: -PASSED: - REQUIRE( ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" ) -with expansion: - "stringmaker(streamable_range)" - == - "stringmaker(streamable_range)" - -ToStringWhich.tests.cpp:: -PASSED: - REQUIRE( ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" ) -with expansion: - "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" - -ToStringWhich.tests.cpp:: -PASSED: - REQUIRE( ::Catch::Detail::stringify(disabled_range{}) == "{ !!! }" ) -with expansion: - "{ !!! }" == "{ !!! }" - -------------------------------------------------------------------------------- -toString( vectors ) -------------------------------------------------------------------------------- -ToStringWhich.tests.cpp: -............................................................................... - -ToStringWhich.tests.cpp:: -PASSED: - REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker }" ) -with expansion: - "{ StringMaker }" - == - "{ StringMaker }" - -------------------------------------------------------------------------------- -toString( vectors ) -------------------------------------------------------------------------------- -ToStringWhich.tests.cpp: -............................................................................... - -ToStringWhich.tests.cpp:: -PASSED: - REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker }" ) -with expansion: - "{ StringMaker }" - == - "{ StringMaker }" - -------------------------------------------------------------------------------- -toString( vectors ) -------------------------------------------------------------------------------- -ToStringWhich.tests.cpp: -............................................................................... - -ToStringWhich.tests.cpp:: -PASSED: - REQUIRE( ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" ) -with expansion: - "{ operator<<( has_operator ) }" - == - "{ operator<<( has_operator ) }" - ------------------------------------------------------------------------------- toString(enum class w/operator<<) ------------------------------------------------------------------------------- diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index cbca0198..1931ee0e 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -820,18 +820,18 @@ Message.tests.cpp: Tricky.tests.cpp: + - + + + + - - - - diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index abfc0590..53c3937f 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -8729,6 +8729,45 @@ loose text artifact + + + + ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" + + + "op<<(streamable_range)" +== +"op<<(streamable_range)" + + + + + ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" + + + "stringmaker(streamable_range)" +== +"stringmaker(streamable_range)" + + + + + ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" + + + "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" + + + + + ::Catch::Detail::stringify(disabled_range{}) == "{ !!! }" + + + "{ !!! }" == "{ !!! }" + + + + @@ -8742,7 +8781,7 @@ loose text artifact - + ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" @@ -8779,6 +8818,45 @@ loose text artifact + + + + ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" + + + "{ StringMaker<has_maker> }" +== +"{ StringMaker<has_maker> }" + + + + + + + + ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }" + + + "{ StringMaker<has_maker_and_operator> }" +== +"{ StringMaker<has_maker_and_operator> }" + + + + + + + + ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" + + + "{ operator<<( has_operator ) }" +== +"{ operator<<( has_operator ) }" + + + + @@ -8823,84 +8901,6 @@ loose text artifact - - - - ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" - - - "op<<(streamable_range)" -== -"op<<(streamable_range)" - - - - - ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" - - - "stringmaker(streamable_range)" -== -"stringmaker(streamable_range)" - - - - - ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" - - - "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" - - - - - ::Catch::Detail::stringify(disabled_range{}) == "{ !!! }" - - - "{ !!! }" == "{ !!! }" - - - - - - - - ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" - - - "{ StringMaker<has_maker> }" -== -"{ StringMaker<has_maker> }" - - - - - - - - ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }" - - - "{ StringMaker<has_maker_and_operator> }" -== -"{ StringMaker<has_maker_and_operator> }" - - - - - - - - ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" - - - "{ operator<<( has_operator ) }" -== -"{ operator<<( has_operator ) }" - - - - diff --git a/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp b/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp index eb1e53e5..7be99dcd 100644 --- a/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp +++ b/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp @@ -59,7 +59,7 @@ TEST_CASE( "stringify( has_maker )", "[toString]" ) { } // Call the stringmaker -TEST_CASE( "stringify( has_maker_and_toString )", "[.][toString]" ) { +TEST_CASE( "stringify( has_maker_and_operator )", "[toString]" ) { has_maker_and_operator item; REQUIRE( ::Catch::Detail::stringify( item ) == "StringMaker" ); } @@ -72,25 +72,22 @@ TEST_CASE("stringify( has_neither )", "[toString]") { // Vectors... -// Don't run this in approval tests as it is sensitive to two phase lookup differences -TEST_CASE( "toString( vectors )", "[toString]" ) { +TEST_CASE( "stringify( vectors )", "[toString]" ) { std::vector v(1); REQUIRE( ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" ); } -TEST_CASE( "toString( vectors )", "[toString]" ) { +TEST_CASE( "stringify( vectors )", "[toString]" ) { std::vector v(1); REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker }" ); } -// Don't run this in approval tests as it is sensitive to two phase lookup differences -TEST_CASE( "toString( vectors )", "[toString]" ) { +TEST_CASE( "stringify( vectors )", "[toString]" ) { std::vector v(1); REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker }" ); } -// Conversion should go -// StringMaker specialization, operator<<, range/enum detection, unprintable +// Range-based conversion should only be used if other possibilities fail struct int_iterator { using iterator_category = std::input_iterator_tag; using difference_type = std::ptrdiff_t; @@ -155,7 +152,7 @@ struct is_range { }; } -TEST_CASE("toString streamable range", "[toString]") { +TEST_CASE("stringify ranges", "[toString]") { REQUIRE(::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)"); REQUIRE(::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)"); REQUIRE(::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }");