mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Added test for stringifying std::arrays
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6852,6 +6852,30 @@ PASSED:
 | 
			
		||||
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
 | 
			
		||||
-------------------------------------------------------------------------------
 | 
			
		||||
@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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}"/>
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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 }" );
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user