mirror of
https://github.com/nlohmann/json.git
synced 2026-02-11 00:12:30 +00:00
fix from_json implementation for pair/tuple
Introduced by 6e4910d5c5
Fixes #707
This commit is contained in:
committed by
Théo DELRIEU
parent
e45eaf6e30
commit
bb1b4c934e
@@ -246,6 +246,7 @@ TEST_CASE("constructors")
|
||||
json j(p);
|
||||
|
||||
CHECK(j.type() == json::value_t::array);
|
||||
CHECK(j.get<decltype(p)>() == p);
|
||||
REQUIRE(j.size() == 2);
|
||||
CHECK(j[0] == std::get<0>(p));
|
||||
CHECK(j[1] == std::get<1>(p));
|
||||
@@ -262,11 +263,12 @@ TEST_CASE("constructors")
|
||||
|
||||
SECTION("std::tuple")
|
||||
{
|
||||
const auto t = std::make_tuple(1.0, "string", 42, std::vector<int> {0, 1});
|
||||
const auto t = std::make_tuple(1.0, std::string{"string"}, 42, std::vector<int> {0, 1});
|
||||
json j(t);
|
||||
|
||||
CHECK(j.type() == json::value_t::array);
|
||||
REQUIRE(j.size() == 4);
|
||||
CHECK(j.get<decltype(t)>() == t);
|
||||
CHECK(j[0] == std::get<0>(t));
|
||||
CHECK(j[1] == std::get<1>(t));
|
||||
CHECK(j[2] == std::get<2>(t));
|
||||
|
||||
Reference in New Issue
Block a user