increase test coverage

This commit is contained in:
Niels 2015-04-11 15:42:54 +02:00
parent 6dceab583c
commit a3210ee2a9
2 changed files with 25 additions and 1 deletions

View file

@ -392,7 +392,7 @@ $ make
$ ./json_unit $ ./json_unit
=============================================================================== ===============================================================================
All tests passed (4332 assertions in 18 test cases) All tests passed (4463 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). For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).

View file

@ -3022,6 +3022,18 @@ TEST_CASE("element access")
{ {
SECTION("erase with one valid iterator") SECTION("erase with one valid iterator")
{ {
SECTION("null")
{
{
json j;
CHECK_THROWS_AS(j.erase(j.begin()), std::runtime_error);
}
{
json j;
CHECK_THROWS_AS(j.erase(j.cbegin()), std::runtime_error);
}
}
SECTION("string") SECTION("string")
{ {
{ {
@ -3140,6 +3152,18 @@ TEST_CASE("element access")
SECTION("erase with two valid iterators") SECTION("erase with two valid iterators")
{ {
SECTION("null")
{
{
json j;
CHECK_THROWS_AS(j.erase(j.begin(), j.end()), std::runtime_error);
}
{
json j;
CHECK_THROWS_AS(j.erase(j.cbegin(), j.cend()), std::runtime_error);
}
}
SECTION("string") SECTION("string")
{ {
{ {