Commit f2e16430 authored by HenryLee's avatar HenryLee

Add test cases for iterator to const iterator assignment

parent 2d5f0c05
......@@ -1519,48 +1519,64 @@ TEST_CASE("iterators 1")
json j = true;
json::const_iterator it = j.begin();
CHECK(it == j.cbegin());
it = j.begin();
CHECK(it == j.cbegin());
}
SECTION("string")
{
json j = "hello world";
json::const_iterator it = j.begin();
CHECK(it == j.cbegin());
it = j.begin();
CHECK(it == j.cbegin());
}
SECTION("array")
{
json j = {1, 2, 3};
json::const_iterator it = j.begin();
CHECK(it == j.cbegin());
it = j.begin();
CHECK(it == j.cbegin());
}
SECTION("object")
{
json j = {{"A", 1}, {"B", 2}, {"C", 3}};
json::const_iterator it = j.begin();
CHECK(it == j.cbegin());
it = j.begin();
CHECK(it == j.cbegin());
}
SECTION("number (integer)")
{
json j = 23;
json::const_iterator it = j.begin();
CHECK(it == j.cbegin());
it = j.begin();
CHECK(it == j.cbegin());
}
SECTION("number (unsigned)")
{
json j = 23u;
json::const_iterator it = j.begin();
CHECK(it == j.cbegin());
it = j.begin();
CHECK(it == j.cbegin());
}
SECTION("number (float)")
{
json j = 23.42;
json::const_iterator it = j.begin();
CHECK(it == j.cbegin());
it = j.begin();
CHECK(it == j.cbegin());
}
SECTION("null")
{
json j = nullptr;
json::const_iterator it = j.begin();
CHECK(it == j.cbegin());
it = j.begin();
CHECK(it == j.cbegin());
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment