🔨 added user-defined exceptions 205-206

This commit is contained in:
Niels Lohmann
2017-03-03 14:00:42 +01:00
parent 875b2da95d
commit a4274d7766
6 changed files with 102 additions and 98 deletions

View File

@@ -689,13 +689,13 @@ TEST_CASE("element access 1")
{
{
json j = "foo";
CHECK_THROWS_AS(j.erase(j.end()), std::out_of_range);
CHECK_THROWS_WITH(j.erase(j.end()), "iterator out of range");
CHECK_THROWS_AS(j.erase(j.end()), json::invalid_iterator);
CHECK_THROWS_WITH(j.erase(j.end()), "[json.exception.invalid_iterator.205] iterator out of range");
}
{
json j = "bar";
CHECK_THROWS_AS(j.erase(j.cend()), std::out_of_range);
CHECK_THROWS_WITH(j.erase(j.cend()), "iterator out of range");
CHECK_THROWS_AS(j.erase(j.cend()), json::invalid_iterator);
CHECK_THROWS_WITH(j.erase(j.cend()), "[json.exception.invalid_iterator.205] iterator out of range");
}
}
@@ -703,13 +703,13 @@ TEST_CASE("element access 1")
{
{
json j = false;
CHECK_THROWS_AS(j.erase(j.end()), std::out_of_range);
CHECK_THROWS_WITH(j.erase(j.end()), "iterator out of range");
CHECK_THROWS_AS(j.erase(j.end()), json::invalid_iterator);
CHECK_THROWS_WITH(j.erase(j.end()), "[json.exception.invalid_iterator.205] iterator out of range");
}
{
json j = true;
CHECK_THROWS_AS(j.erase(j.cend()), std::out_of_range);
CHECK_THROWS_WITH(j.erase(j.cend()), "iterator out of range");
CHECK_THROWS_AS(j.erase(j.cend()), json::invalid_iterator);
CHECK_THROWS_WITH(j.erase(j.cend()), "[json.exception.invalid_iterator.205] iterator out of range");
}
}
@@ -717,13 +717,13 @@ TEST_CASE("element access 1")
{
{
json j = 17;
CHECK_THROWS_AS(j.erase(j.end()), std::out_of_range);
CHECK_THROWS_WITH(j.erase(j.end()), "iterator out of range");
CHECK_THROWS_AS(j.erase(j.end()), json::invalid_iterator);
CHECK_THROWS_WITH(j.erase(j.end()), "[json.exception.invalid_iterator.205] iterator out of range");
}
{
json j = 17;
CHECK_THROWS_AS(j.erase(j.cend()), std::out_of_range);
CHECK_THROWS_WITH(j.erase(j.cend()), "iterator out of range");
CHECK_THROWS_AS(j.erase(j.cend()), json::invalid_iterator);
CHECK_THROWS_WITH(j.erase(j.cend()), "[json.exception.invalid_iterator.205] iterator out of range");
}
}
@@ -731,13 +731,13 @@ TEST_CASE("element access 1")
{
{
json j = 17u;
CHECK_THROWS_AS(j.erase(j.end()), std::out_of_range);
CHECK_THROWS_WITH(j.erase(j.end()), "iterator out of range");
CHECK_THROWS_AS(j.erase(j.end()), json::invalid_iterator);
CHECK_THROWS_WITH(j.erase(j.end()), "[json.exception.invalid_iterator.205] iterator out of range");
}
{
json j = 17u;
CHECK_THROWS_AS(j.erase(j.cend()), std::out_of_range);
CHECK_THROWS_WITH(j.erase(j.cend()), "iterator out of range");
CHECK_THROWS_AS(j.erase(j.cend()), json::invalid_iterator);
CHECK_THROWS_WITH(j.erase(j.cend()), "[json.exception.invalid_iterator.205] iterator out of range");
}
}
@@ -745,13 +745,13 @@ TEST_CASE("element access 1")
{
{
json j = 23.42;
CHECK_THROWS_AS(j.erase(j.end()), std::out_of_range);
CHECK_THROWS_WITH(j.erase(j.end()), "iterator out of range");
CHECK_THROWS_AS(j.erase(j.end()), json::invalid_iterator);
CHECK_THROWS_WITH(j.erase(j.end()), "[json.exception.invalid_iterator.205] iterator out of range");
}
{
json j = 23.42;
CHECK_THROWS_AS(j.erase(j.cend()), std::out_of_range);
CHECK_THROWS_WITH(j.erase(j.cend()), "iterator out of range");
CHECK_THROWS_AS(j.erase(j.cend()), json::invalid_iterator);
CHECK_THROWS_WITH(j.erase(j.cend()), "[json.exception.invalid_iterator.205] iterator out of range");
}
}
}