Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/UsageTests/ToStringVector.tests.cpp
diff options
context:
space:
mode:
authorPhil Nash2018-01-08 11:13:29 +0000
committerPhil Nash2018-01-08 11:13:29 +0000
commit161dd4ed2449c7b02ffdfda607ffb0924d916c3c (patch)
tree094b03b0135710bf1ef18d4c95afa2d56d4805ba /projects/SelfTest/UsageTests/ToStringVector.tests.cpp
parent13ea4225e7c45214b0c6faf20cd65bb680937f4d (diff)
parent2c43620d9baed1fdcaa9146af1d3eb90520cbe92 (diff)
downloadcatch3-161dd4ed2449c7b02ffdfda607ffb0924d916c3c.tar.gz
Merge commit '2c43620d9baed1fdcaa9146af1d3eb90520cbe92'
Diffstat (limited to 'projects/SelfTest/UsageTests/ToStringVector.tests.cpp')
-rw-r--r--projects/SelfTest/UsageTests/ToStringVector.tests.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/projects/SelfTest/UsageTests/ToStringVector.tests.cpp b/projects/SelfTest/UsageTests/ToStringVector.tests.cpp
index df9c55ab..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]" )
@@ -66,3 +66,21 @@ TEST_CASE( "vec<vec<string,alloc>> -> toString", "[toString][vector,allocator]"
v.push_back( inner { "world" } );
REQUIRE( ::Catch::Detail::stringify(v) == "{ { \"hello\" }, { \"world\" } }" );
}
+
+// Based on PR by mat-so: https://github.com/catchorg/Catch2/pull/606/files#diff-43562f40f8c6dcfe2c54557316e0f852
+TEST_CASE( "vector<bool> -> toString", "[toString][containers][vector]" ) {
+ std::vector<bool> bools;
+ REQUIRE( ::Catch::Detail::stringify(bools) == "{ }");
+ bools.push_back(true);
+ REQUIRE( ::Catch::Detail::stringify(bools) == "{ true }");
+ 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