overworked iterators
This commit is contained in:
parent
76be1ae1f6
commit
bbc45eb4d8
4 changed files with 374 additions and 530 deletions
|
@ -1371,35 +1371,35 @@ TEST_CASE("Iterators")
|
|||
CHECK(* j7.begin() == json("hello"));
|
||||
CHECK(* j7_const.begin() == json("hello"));
|
||||
|
||||
CHECK_THROWS_AS(* j1.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j1.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j2.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j2.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j3.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j3.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j4.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j4.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j5.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j5.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j6.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j6.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j7.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j7.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j1.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j1.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j2.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j2.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j3.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j3.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j4.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j4.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j5.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j5.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j6.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j6.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j7.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j7.cend(), std::out_of_range);
|
||||
|
||||
CHECK_THROWS_AS(* j1_const.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j1_const.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j2_const.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j2_const.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j3_const.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j3_const.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j4_const.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j4_const.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j5_const.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j5_const.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j6_const.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j6_const.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j7_const.end(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j7_const.cend(), std::runtime_error);
|
||||
CHECK_THROWS_AS(* j1_const.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j1_const.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j2_const.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j2_const.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j3_const.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j3_const.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j4_const.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j4_const.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j5_const.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j5_const.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j6_const.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j6_const.cend(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j7_const.end(), std::out_of_range);
|
||||
CHECK_THROWS_AS(* j7_const.cend(), std::out_of_range);
|
||||
|
||||
// operator ->
|
||||
CHECK(j1.begin()->type() == json::value_t::number);
|
||||
|
@ -1432,35 +1432,35 @@ TEST_CASE("Iterators")
|
|||
CHECK(j7_const.begin()->type() == json::value_t::string);
|
||||
CHECK(j7_const.cbegin()->type() == json::value_t::string);
|
||||
|
||||
CHECK_THROWS_AS(j1.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j1.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j2.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j2.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j3.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j3.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j4.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j4.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j5.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j5.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j6.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j6.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j7.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j7.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j1.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j1.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j2.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j2.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j3.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j3.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j4.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j4.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j5.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j5.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j6.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j6.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j7.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j7.cend()->type(), std::out_of_range);
|
||||
|
||||
CHECK_THROWS_AS(j1_const.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j1_const.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j2_const.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j2_const.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j3_const.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j3_const.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j4_const.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j4_const.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j5_const.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j5_const.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j6_const.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j6_const.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j7_const.end()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j7_const.cend()->type(), std::runtime_error);
|
||||
CHECK_THROWS_AS(j1_const.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j1_const.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j2_const.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j2_const.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j3_const.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j3_const.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j4_const.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j4_const.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j5_const.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j5_const.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j6_const.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j6_const.cend()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j7_const.end()->type(), std::out_of_range);
|
||||
CHECK_THROWS_AS(j7_const.cend()->type(), std::out_of_range);
|
||||
|
||||
// value
|
||||
CHECK(j1.begin().value().type() == json::value_t::number);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue