Add test cases for iterator to const iterator assignment
This commit is contained in:
parent
2d5f0c0549
commit
f2e1643039
1 changed files with 16 additions and 0 deletions
|
@ -1519,48 +1519,64 @@ TEST_CASE("iterators 1")
|
||||||
json j = true;
|
json j = true;
|
||||||
json::const_iterator it = j.begin();
|
json::const_iterator it = j.begin();
|
||||||
CHECK(it == j.cbegin());
|
CHECK(it == j.cbegin());
|
||||||
|
it = j.begin();
|
||||||
|
CHECK(it == j.cbegin());
|
||||||
}
|
}
|
||||||
SECTION("string")
|
SECTION("string")
|
||||||
{
|
{
|
||||||
json j = "hello world";
|
json j = "hello world";
|
||||||
json::const_iterator it = j.begin();
|
json::const_iterator it = j.begin();
|
||||||
CHECK(it == j.cbegin());
|
CHECK(it == j.cbegin());
|
||||||
|
it = j.begin();
|
||||||
|
CHECK(it == j.cbegin());
|
||||||
}
|
}
|
||||||
SECTION("array")
|
SECTION("array")
|
||||||
{
|
{
|
||||||
json j = {1, 2, 3};
|
json j = {1, 2, 3};
|
||||||
json::const_iterator it = j.begin();
|
json::const_iterator it = j.begin();
|
||||||
CHECK(it == j.cbegin());
|
CHECK(it == j.cbegin());
|
||||||
|
it = j.begin();
|
||||||
|
CHECK(it == j.cbegin());
|
||||||
}
|
}
|
||||||
SECTION("object")
|
SECTION("object")
|
||||||
{
|
{
|
||||||
json j = {{"A", 1}, {"B", 2}, {"C", 3}};
|
json j = {{"A", 1}, {"B", 2}, {"C", 3}};
|
||||||
json::const_iterator it = j.begin();
|
json::const_iterator it = j.begin();
|
||||||
CHECK(it == j.cbegin());
|
CHECK(it == j.cbegin());
|
||||||
|
it = j.begin();
|
||||||
|
CHECK(it == j.cbegin());
|
||||||
}
|
}
|
||||||
SECTION("number (integer)")
|
SECTION("number (integer)")
|
||||||
{
|
{
|
||||||
json j = 23;
|
json j = 23;
|
||||||
json::const_iterator it = j.begin();
|
json::const_iterator it = j.begin();
|
||||||
CHECK(it == j.cbegin());
|
CHECK(it == j.cbegin());
|
||||||
|
it = j.begin();
|
||||||
|
CHECK(it == j.cbegin());
|
||||||
}
|
}
|
||||||
SECTION("number (unsigned)")
|
SECTION("number (unsigned)")
|
||||||
{
|
{
|
||||||
json j = 23u;
|
json j = 23u;
|
||||||
json::const_iterator it = j.begin();
|
json::const_iterator it = j.begin();
|
||||||
CHECK(it == j.cbegin());
|
CHECK(it == j.cbegin());
|
||||||
|
it = j.begin();
|
||||||
|
CHECK(it == j.cbegin());
|
||||||
}
|
}
|
||||||
SECTION("number (float)")
|
SECTION("number (float)")
|
||||||
{
|
{
|
||||||
json j = 23.42;
|
json j = 23.42;
|
||||||
json::const_iterator it = j.begin();
|
json::const_iterator it = j.begin();
|
||||||
CHECK(it == j.cbegin());
|
CHECK(it == j.cbegin());
|
||||||
|
it = j.begin();
|
||||||
|
CHECK(it == j.cbegin());
|
||||||
}
|
}
|
||||||
SECTION("null")
|
SECTION("null")
|
||||||
{
|
{
|
||||||
json j = nullptr;
|
json j = nullptr;
|
||||||
json::const_iterator it = j.begin();
|
json::const_iterator it = j.begin();
|
||||||
CHECK(it == j.cbegin());
|
CHECK(it == j.cbegin());
|
||||||
|
it = j.begin();
|
||||||
|
CHECK(it == j.cbegin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue