diff options
| author | Phil Nash | 2018-01-04 10:52:55 +0000 |
|---|---|---|
| committer | Phil Nash | 2018-01-04 10:52:55 +0000 |
| commit | 8be1df243e18e4a511b413f49f69546bb4607d2c (patch) | |
| tree | 019a3bd339096c5fc345d0b7113af34c87800d12 /projects | |
| parent | 32eb90b9bdaf45bb1d76ca8bc4efaa3aeaf9a134 (diff) | |
| download | catch3-8be1df243e18e4a511b413f49f69546bb4607d2c.tar.gz | |
Added test for stringifying std::arrays
Diffstat (limited to 'projects')
6 files changed, 71 insertions, 8 deletions
diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt index 2c9b0b80..e7dafe5a 100644 --- a/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -874,6 +874,9 @@ Xml.tests.cpp:<line number>: passed: encode( stringWithQuotes, Catch::XmlEncode: "don't "quote" me on that" Xml.tests.cpp:<line number>: passed: encode( "[/x01]" ) == "[//x01]" for: "[/x01]" == "[/x01]" Xml.tests.cpp:<line number>: passed: encode( "[/x7F]" ) == "[//x7F]" for: "[/x7F]" == "[/x7F]" +ToStringVector.tests.cpp:<line number>: passed: Catch::Detail::stringify( empty ) == "{ }" for: "{ }" == "{ }" +ToStringVector.tests.cpp:<line number>: passed: Catch::Detail::stringify( oneValue ) == "{ 42 }" for: "{ 42 }" == "{ 42 }" +ToStringVector.tests.cpp:<line number>: passed: Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" for: "{ 42, 250 }" == "{ 42, 250 }" Misc.tests.cpp:<line number>: passed: x == 0 for: 0 == 0 Tricky.tests.cpp:<line number>: passed: obj.prop != 0 for: 0x<hex digits> != 0 Misc.tests.cpp:<line number>: passed: flag for: true diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 9bb8e8c3..375fb71a 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1064,6 +1064,6 @@ with expansion: "first" == "second" =============================================================================== -test cases: 194 | 143 passed | 47 failed | 4 failed as expected -assertions: 980 | 854 passed | 105 failed | 21 failed as expected +test cases: 195 | 144 passed | 47 failed | 4 failed as expected +assertions: 983 | 857 passed | 105 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index a457fa8d..57c3ca79 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -6853,6 +6853,30 @@ with expansion: "[\x7F]" == "[\x7F]" ------------------------------------------------------------------------------- +array<int, N> -> toString +------------------------------------------------------------------------------- +ToStringVector.tests.cpp:<line number> +............................................................................... + +ToStringVector.tests.cpp:<line number>: +PASSED: + REQUIRE( Catch::Detail::stringify( empty ) == "{ }" ) +with expansion: + "{ }" == "{ }" + +ToStringVector.tests.cpp:<line number>: +PASSED: + REQUIRE( Catch::Detail::stringify( oneValue ) == "{ 42 }" ) +with expansion: + "{ 42 }" == "{ 42 }" + +ToStringVector.tests.cpp:<line number>: +PASSED: + REQUIRE( Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" ) +with expansion: + "{ 42, 250 }" == "{ 42, 250 }" + +------------------------------------------------------------------------------- atomic if ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -8222,6 +8246,6 @@ Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 194 | 141 passed | 49 failed | 4 failed as expected -assertions: 979 | 850 passed | 108 failed | 21 failed as expected +test cases: 195 | 142 passed | 49 failed | 4 failed as expected +assertions: 982 | 853 passed | 108 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 58d76e46..c7d422a8 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="15" failures="94" tests="980" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="15" failures="94" tests="983" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <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}"/> @@ -698,6 +698,7 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="XmlEncode/string with quotes" time="{duration}"/> <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (1)" time="{duration}"/> <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (x7F)" time="{duration}"/> + <testcase classname="<exe-name>.global" name="array<int, N> -> toString" time="{duration}"/> <testcase classname="<exe-name>.global" name="atomic if" time="{duration}"/> <testcase classname="<exe-name>.global" name="boolean member" time="{duration}"/> <testcase classname="<exe-name>.global" name="checkedElse" time="{duration}"/> diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index c3fc5265..18823424 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -7749,6 +7749,33 @@ Message from section two </Section> <OverallResult success="true"/> </TestCase> + <TestCase name="array<int, N> -> toString" tags="[array][containers][toString]" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + Catch::Detail::stringify( empty ) == "{ }" + </Original> + <Expanded> + "{ }" == "{ }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + Catch::Detail::stringify( oneValue ) == "{ 42 }" + </Original> + <Expanded> + "{ 42 }" == "{ 42 }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" + </Original> + <Expanded> + "{ 42, 250 }" == "{ 42, 250 }" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> <TestCase name="atomic if" tags="[0][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -9141,7 +9168,7 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="850" failures="109" expectedFailures="21"/> + <OverallResults successes="853" failures="109" expectedFailures="21"/> </Group> - <OverallResults successes="850" failures="108" expectedFailures="21"/> + <OverallResults successes="853" failures="108" expectedFailures="21"/> </Catch> diff --git a/projects/SelfTest/UsageTests/ToStringVector.tests.cpp b/projects/SelfTest/UsageTests/ToStringVector.tests.cpp index 0b993c4e..18e56c08 100644 --- a/projects/SelfTest/UsageTests/ToStringVector.tests.cpp +++ b/projects/SelfTest/UsageTests/ToStringVector.tests.cpp @@ -1,6 +1,6 @@ #include "catch.hpp" #include <vector> - +#include <array> // vedctor TEST_CASE( "vector<int> -> toString", "[toString][vector]" ) @@ -76,3 +76,11 @@ TEST_CASE( "vector<bool> -> toString", "[toString][containers][vector]" ) { bools.push_back(false); REQUIRE( ::Catch::Detail::stringify(bools) == "{ true, false }"); } +TEST_CASE( "array<int, N> -> toString", "[toString][containers][array]" ) { + std::array<int, 0> empty; + REQUIRE( Catch::Detail::stringify( empty ) == "{ }" ); + std::array<int, 1> oneValue = {{ 42 }}; + REQUIRE( Catch::Detail::stringify( oneValue ) == "{ 42 }" ); + std::array<int, 2> twoValues = {{ 42, 250 }}; + REQUIRE( Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" ); +}
\ No newline at end of file |