implemented missing operator[]

This commit is contained in:
Niels 2015-01-23 18:27:58 +01:00
parent 36f14d21da
commit 807de40463
4 changed files with 54 additions and 10 deletions

View file

@ -504,6 +504,18 @@ TEST_CASE("object")
bool v4 = j[std::string("k4")];
CHECK(v4 == true);
}
{
const std::string v0 = k["k0"];
CHECK(v0 == "v0");
auto v1 = k["k1"];
CHECK(v1 == nullptr);
int v2 = k["k2"];
CHECK(v2 == 42);
double v3 = k["k3"];
CHECK(v3 == 3.141);
bool v4 = k["k4"];
CHECK(v4 == true);
}
{
const std::string v0 = k[std::string("k0")];
CHECK(v0 == "v0");
@ -925,6 +937,12 @@ TEST_CASE("null")
CHECK(n1 == json());
CHECK(n2 == json());
json::reverse_iterator ri = n1.rbegin();
ri--;
json::const_reverse_iterator rci = n1.crbegin();
rci--;
}
}