Skip to content

Commit

Permalink
💚 overwork tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Nov 23, 2019
1 parent 1359c56 commit 713038f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/src/unit-conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1617,21 +1617,20 @@ TEST_CASE("std::optional")

SECTION("array")
{
json j_array = {1, 2, 3};
std::optional<std::vector<int>> opt_array = {{1, 2, 3}};
json j_array = {1, 2, nullptr};
std::vector<std::optional<int>> opt_array = {{1, 2, std::nullopt}};

CHECK(json(opt_array) == j_array);
CHECK(std::optional<std::vector<int>>(j_array) == opt_array);
CHECK(std::vector<std::optional<int>>(j_array) == opt_array);
}

SECTION("object")
{
json j_object = {{"one", 1}, {"two", 2}};
std::map<std::string, int> m {{"one", 1}, {"two", 2}};
std::optional<std::map<std::string, int>> opt_object = m;
json j_object = {{"one", 1}, {"two", 2}, {"zero", nullptr}};
std::map<std::string, std::optional<int>> opt_object {{"one", 1}, {"two", 2}, {"zero", std::nullopt}};

CHECK(json(opt_object) == j_object);
CHECK(std::optional<std::map<std::string, int>>(j_object) == opt_object);
CHECK(std::map<std::string, std::optional<int>>(j_object) == opt_object);
}
}
#endif

0 comments on commit 713038f

Please sign in to comment.