add a test for the iterator_wrapper
This commit is contained in:
parent
c974e32677
commit
b5a05e1121
1 changed files with 18 additions and 0 deletions
|
@ -7547,6 +7547,24 @@ TEST_CASE("iterator class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("iterator_wrapper")
|
||||||
|
{
|
||||||
|
SECTION("objects")
|
||||||
|
{
|
||||||
|
json j_object = {{"key1", 1}, {"key2", 2}};
|
||||||
|
for (auto it : json::iterator_wrapper(j_object))
|
||||||
|
{
|
||||||
|
CHECK((it.first == "key1" or it.first == "key2"));
|
||||||
|
CHECK((it.key() == "key1" or it.key() == "key2"));
|
||||||
|
CHECK(it.key() == it.first);
|
||||||
|
|
||||||
|
CHECK((it.second == json(1) or it.second == json(2)));
|
||||||
|
CHECK((it.value() == json(1) or it.value() == json(2)));
|
||||||
|
CHECK(it.value() == it.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("const_iterator class")
|
TEST_CASE("const_iterator class")
|
||||||
{
|
{
|
||||||
SECTION("construction")
|
SECTION("construction")
|
||||||
|
|
Loading…
Add table
Reference in a new issue