diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aaed628..ff3527b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - testing pull_request: branches: diff --git a/test/test_converter.cpp b/test/test_converter.cpp index 189e292..dcea7f6 100644 --- a/test/test_converter.cpp +++ b/test/test_converter.cpp @@ -1,19 +1,18 @@ -#include -#include #include +#include +#include TEST_CASE("testing split") { ss::converter c; + for (const auto& [s, expected, delim] : - // clang-format off - {std::tuple{"a,b,c,d", std::vector{"a", "b", "c", "d"}, ","}, - {"", {}, " "}, - {"a,b,c", {"a", "b", "c"}, ""}, - {" x x x x | x ", {" x x x x ", " x "}, "|"}, - {"a::b::c::d", {"a", "b", "c", "d"}, "::"}, - {"x\t-\ty", {"x", "y"}, "\t-\t"}, - {"x", {"x"}, ","}} // clang-format on - ) { + {std::make_tuple("a,b,c,d", std::vector{"a", "b", "c", "d"}, ","), + {"", {}, " "}, + {"a,b,c", {"a", "b", "c"}, ""}, + {" x x x x | x ", {" x x x x ", " x "}, "|"}, + {"a::b::c::d", {"a", "b", "c", "d"}, "::"}, + {"x\t-\ty", {"x", "y"}, "\t-\t"}, + {"x", {"x"}, ","}}) { auto split = c.split(s, delim); CHECK(split.size() == expected.size()); for (size_t i = 0; i < split.size(); ++i) { @@ -66,31 +65,31 @@ TEST_CASE("testing valid conversions") { { auto tup = c.convert("5,6.6,junk"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{5, 6.6}); + CHECK(tup == std::make_tuple(5, 6.6)); } { auto tup = c.convert("5,junk,6.6"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{5, 6.6}); + CHECK(tup == std::make_tuple(5, 6.6)); } { auto tup = c.convert("junk;5;6.6", ";"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{5, 6.6}); + CHECK(tup == std::make_tuple(5, 6.6)); } { auto tup = c.convert, double>("junk;5;6.6", ";"); REQUIRE(c.valid()); REQUIRE(std::get<0>(tup).has_value()); - CHECK(tup == std::tuple{5, 6.6}); + CHECK(tup == std::make_tuple(5, 6.6)); } { auto tup = c.convert, double>("junk;5.4;6.6", ";"); REQUIRE(c.valid()); REQUIRE(!std::get<0>(tup).has_value()); - CHECK(tup == std::tuple{std::nullopt, 6.6}); + CHECK(tup == std::make_tuple(std::optional{}, 6.6)); } { auto tup = @@ -98,7 +97,7 @@ TEST_CASE("testing valid conversions") { ";"); REQUIRE(c.valid()); REQUIRE(std::holds_alternative(std::get<0>(tup))); - CHECK(tup == std::tuple{std::variant{5}, 6.6}); + CHECK(tup == std::make_tuple(std::variant{5}, 6.6)); } { auto tup = @@ -106,7 +105,7 @@ TEST_CASE("testing valid conversions") { ";"); REQUIRE(c.valid()); REQUIRE(std::holds_alternative(std::get<0>(tup))); - CHECK(tup == std::tuple{std::variant{5.5}, 6.6}); + CHECK(tup == std::make_tuple(std::variant{5.5}, 6.6)); } } @@ -163,12 +162,12 @@ TEST_CASE("testing ss:ax restriction (all except)") { { std::tuple tup = c.convert>("c,3"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{'c', 3}); + CHECK(tup == std::make_tuple('c', 3)); } { std::tuple tup = c.convert, char>("3,c"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{3, 'c'}); + CHECK(tup == std::make_tuple(3, 'c')); } } @@ -197,12 +196,12 @@ TEST_CASE("testing ss:nx restriction (none except)") { { auto tup = c.convert>("c,junk,1"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{'c', 1}); + CHECK(tup == std::make_tuple('c', 1)); } { auto tup = c.convert, char>("1,c"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{1, 'c'}); + CHECK(tup == std::make_tuple(1, 'c')); } } @@ -231,12 +230,12 @@ TEST_CASE("testing ss:ir restriction (in range)") { { auto tup = c.convert>("c,junk,1"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{'c', 1}); + CHECK(tup == std::make_tuple('c', 1)); } { auto tup = c.convert, char>("1,c"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{1, 'c'}); + CHECK(tup == std::make_tuple(1, 'c')); } } @@ -264,13 +263,13 @@ TEST_CASE("testing ss:oor restriction (out of range)") { { auto tup = c.convert>("c,junk,3"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{'c', 3}); + CHECK(tup == std::make_tuple('c', 3)); } { auto tup = c.convert, char>("3,c"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{3, 'c'}); + CHECK(tup == std::make_tuple(3, 'c')); } } @@ -313,7 +312,7 @@ TEST_CASE("testing ss:ne restriction (not empty)") { { auto tup = c.convert, ss::ne>("1,s"); REQUIRE(c.valid()); - CHECK(tup == std::tuple{1, "s"}); + CHECK(tup == std::make_tuple(1, "s")); } { auto tup = c.convert>>("{1 2 3}");