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

summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorDimitrij Mijoski2021-03-26 02:04:45 +0100
committerMartin Hořeňovský2021-05-26 00:34:23 +0200
commit86f86c4c232b1698bb69fe70a086b3005a2c1de4 (patch)
treefe684cde91fa711add01dfd5d61ed58aae68ccbd /tests
parent023b5306b444ebe3c20a008cdd150cf5510ff36d (diff)
downloadcatch3-86f86c4c232b1698bb69fe70a086b3005a2c1de4.tar.gz
Fix compiling with C++17 + Clang 5 + libstdc++ v5
This basically tests the combination where the compiler supports most of C++17 but the library does not.
Diffstat (limited to 'tests')
-rw-r--r--tests/SelfTest/UsageTests/Generators.tests.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/SelfTest/UsageTests/Generators.tests.cpp b/tests/SelfTest/UsageTests/Generators.tests.cpp
index acfef8a9..b2154a1a 100644
--- a/tests/SelfTest/UsageTests/Generators.tests.cpp
+++ b/tests/SelfTest/UsageTests/Generators.tests.cpp
@@ -62,12 +62,12 @@ TEST_CASE("tables", "[generators]") {
// Structured bindings make the table utility much nicer to use
TEST_CASE( "strlen2", "[approvals][generators]" ) {
- auto [test_input, expected] = GENERATE( table<std::string, size_t>({
- {"one", 3},
- {"two", 3},
- {"three", 5},
- {"four", 4}
- }));
+ using tuple_type = std::tuple<std::string, int>; // see above workaround
+ auto [test_input, expected] =
+ GENERATE( table<std::string, size_t>( { tuple_type{ "one", 3 },
+ tuple_type{ "two", 3 },
+ tuple_type{ "three", 5 },
+ tuple_type{ "four", 4 } } ) );
REQUIRE( test_input.size() == expected );
}
@@ -103,11 +103,9 @@ TEST_CASE( "strlen3", "[generators]" ) {
static auto eatCucumbers( int start, int eat ) -> int { return start-eat; }
SCENARIO("Eating cucumbers", "[generators][approvals]") {
-
- auto [start, eat, left] = GENERATE( table<int,int,int> ({
- { 12, 5, 7 },
- { 20, 5, 15 }
- }));
+ using tuple_type = std::tuple<int, int, int>;
+ auto [start, eat, left] = GENERATE( table<int, int, int>(
+ { tuple_type{ 12, 5, 7 }, tuple_type{ 20, 5, 15 } } ) );
GIVEN( "there are " << start << " cucumbers" )
WHEN( "I eat " << eat << " cucumbers" )