mirror of
https://github.com/nlohmann/json.git
synced 2025-01-18 23:35:13 +08:00
improved test case coverage
This commit is contained in:
parent
1bdb6acb1f
commit
9e8e11339d
@ -379,7 +379,7 @@ $ make
|
||||
$ ./json_unit
|
||||
|
||||
===============================================================================
|
||||
All tests passed (4280 assertions in 16 test cases)
|
||||
All tests passed (4332 assertions in 18 test cases)
|
||||
```
|
||||
|
||||
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
|
||||
|
@ -2050,6 +2050,11 @@ TEST_CASE("value conversion")
|
||||
//auto m4 = j4.get<std::unordered_multimap<std::string, std::string>>();
|
||||
//CHECK(m4["one"] == "eins");
|
||||
}
|
||||
|
||||
SECTION("exception in case of a non-object type")
|
||||
{
|
||||
CHECK_THROWS_AS((json().get<std::map<std::string, int>>()), std::logic_error);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("array-like STL containers")
|
||||
@ -2106,6 +2111,13 @@ TEST_CASE("value conversion")
|
||||
auto m3 = j3.get<std::unordered_set<bool>>();
|
||||
auto m4 = j4.get<std::unordered_set<std::string>>();
|
||||
}
|
||||
|
||||
SECTION("exception in case of a non-object type")
|
||||
{
|
||||
CHECK_THROWS_AS((json().get<std::list<int>>()), std::logic_error);
|
||||
CHECK_THROWS_AS((json().get<std::vector<int>>()), std::logic_error);
|
||||
CHECK_THROWS_AS((json().get<std::vector<json>>()), std::logic_error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user