Commit 9e8e1133 authored by Niels's avatar Niels

improved test case coverage

parent 1bdb6acb
......@@ -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);
}
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment