Added test for stringifying std::arrays

This commit is contained in:
Phil Nash 2018-01-04 10:52:55 +00:00
parent 32eb90b9bd
commit 8be1df243e
6 changed files with 71 additions and 8 deletions

View file

@ -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 }" );
}