replate tuple constructors with make_tuple

This commit is contained in:
ado 2021-01-07 23:24:06 +01:00
parent 99ac9e49f6
commit 758227a16f

View File

@ -65,31 +65,31 @@ TEST_CASE("testing valid conversions") {
{ {
auto tup = c.convert<int, double, void>("5,6.6,junk"); auto tup = c.convert<int, double, void>("5,6.6,junk");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{5, 6.6}); CHECK(tup == std::make_tuple(5, 6.6));
} }
{ {
auto tup = c.convert<int, void, double>("5,junk,6.6"); auto tup = c.convert<int, void, double>("5,junk,6.6");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{5, 6.6}); CHECK(tup == std::make_tuple(5, 6.6));
} }
{ {
auto tup = c.convert<void, int, double>("junk;5;6.6", ";"); auto tup = c.convert<void, int, double>("junk;5;6.6", ";");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{5, 6.6}); CHECK(tup == std::make_tuple(5, 6.6));
} }
{ {
auto tup = auto tup =
c.convert<void, std::optional<int>, double>("junk;5;6.6", ";"); c.convert<void, std::optional<int>, double>("junk;5;6.6", ";");
REQUIRE(c.valid()); REQUIRE(c.valid());
REQUIRE(std::get<0>(tup).has_value()); REQUIRE(std::get<0>(tup).has_value());
CHECK(tup == std::tuple{5, 6.6}); CHECK(tup == std::make_tuple(5, 6.6));
} }
{ {
auto tup = auto tup =
c.convert<void, std::optional<int>, double>("junk;5.4;6.6", ";"); c.convert<void, std::optional<int>, double>("junk;5.4;6.6", ";");
REQUIRE(c.valid()); REQUIRE(c.valid());
REQUIRE(!std::get<0>(tup).has_value()); REQUIRE(!std::get<0>(tup).has_value());
CHECK(tup == std::tuple{std::nullopt, 6.6}); CHECK(tup == std::make_tuple(std::optional<int>{}, 6.6));
} }
{ {
auto tup = auto tup =
@ -97,7 +97,7 @@ TEST_CASE("testing valid conversions") {
";"); ";");
REQUIRE(c.valid()); REQUIRE(c.valid());
REQUIRE(std::holds_alternative<int>(std::get<0>(tup))); REQUIRE(std::holds_alternative<int>(std::get<0>(tup)));
CHECK(tup == std::tuple{std::variant<int, double>{5}, 6.6}); CHECK(tup == std::make_tuple(std::variant<int, double>{5}, 6.6));
} }
{ {
auto tup = auto tup =
@ -105,7 +105,7 @@ TEST_CASE("testing valid conversions") {
";"); ";");
REQUIRE(c.valid()); REQUIRE(c.valid());
REQUIRE(std::holds_alternative<double>(std::get<0>(tup))); REQUIRE(std::holds_alternative<double>(std::get<0>(tup)));
CHECK(tup == std::tuple{std::variant<int, double>{5.5}, 6.6}); CHECK(tup == std::make_tuple(std::variant<int, double>{5.5}, 6.6));
} }
} }
@ -162,12 +162,12 @@ TEST_CASE("testing ss:ax restriction (all except)") {
{ {
std::tuple<char, int> tup = c.convert<char, ss::ax<int, 1>>("c,3"); std::tuple<char, int> tup = c.convert<char, ss::ax<int, 1>>("c,3");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{'c', 3}); CHECK(tup == std::make_tuple('c', 3));
} }
{ {
std::tuple<int, char> tup = c.convert<ss::ax<int, 1>, char>("3,c"); std::tuple<int, char> tup = c.convert<ss::ax<int, 1>, char>("3,c");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{3, 'c'}); CHECK(tup == std::make_tuple(3, 'c'));
} }
} }
@ -196,12 +196,12 @@ TEST_CASE("testing ss:nx restriction (none except)") {
{ {
auto tup = c.convert<char, void, ss::nx<int, 0, 1, 2>>("c,junk,1"); auto tup = c.convert<char, void, ss::nx<int, 0, 1, 2>>("c,junk,1");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{'c', 1}); CHECK(tup == std::make_tuple('c', 1));
} }
{ {
auto tup = c.convert<ss::nx<int, 1>, char>("1,c"); auto tup = c.convert<ss::nx<int, 1>, char>("1,c");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{1, 'c'}); CHECK(tup == std::make_tuple(1, 'c'));
} }
} }
@ -230,12 +230,12 @@ TEST_CASE("testing ss:ir restriction (in range)") {
{ {
auto tup = c.convert<char, void, ss::ir<int, 0, 1>>("c,junk,1"); auto tup = c.convert<char, void, ss::ir<int, 0, 1>>("c,junk,1");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{'c', 1}); CHECK(tup == std::make_tuple('c', 1));
} }
{ {
auto tup = c.convert<ss::ir<int, 1, 20>, char>("1,c"); auto tup = c.convert<ss::ir<int, 1, 20>, char>("1,c");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{1, 'c'}); CHECK(tup == std::make_tuple(1, 'c'));
} }
} }
@ -263,13 +263,13 @@ TEST_CASE("testing ss:oor restriction (out of range)") {
{ {
auto tup = c.convert<char, void, ss::oor<int, 4, 69>>("c,junk,3"); auto tup = c.convert<char, void, ss::oor<int, 4, 69>>("c,junk,3");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{'c', 3}); CHECK(tup == std::make_tuple('c', 3));
} }
{ {
auto tup = c.convert<ss::oor<int, 1, 2>, char>("3,c"); auto tup = c.convert<ss::oor<int, 1, 2>, char>("3,c");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{3, 'c'}); CHECK(tup == std::make_tuple(3, 'c'));
} }
} }
@ -312,7 +312,7 @@ TEST_CASE("testing ss:ne restriction (not empty)") {
{ {
auto tup = c.convert<std::optional<int>, ss::ne<std::string>>("1,s"); auto tup = c.convert<std::optional<int>, ss::ne<std::string>>("1,s");
REQUIRE(c.valid()); REQUIRE(c.valid());
CHECK(tup == std::tuple{1, "s"}); CHECK(tup == std::make_tuple(1, "s"));
} }
{ {
auto tup = c.convert<ss::ne<std::vector<int>>>("{1 2 3}"); auto tup = c.convert<ss::ne<std::vector<int>>>("{1 2 3}");