💚 add test for ordered_map

This commit is contained in:
Niels Lohmann 2020-07-11 19:24:32 +02:00
parent 3a80823ff8
commit 738c83d6af
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69

View file

@ -59,6 +59,13 @@ TEST_CASE("ordered_json")
CHECK(j.dump() == "{\"element2\":2,\"element3\":3}"); CHECK(j.dump() == "{\"element2\":2,\"element3\":3}");
CHECK(oj.dump() == "{\"element3\":3,\"element2\":2}"); CHECK(oj.dump() == "{\"element3\":3,\"element2\":2}");
// remove again and nothing changes
j.erase("element1");
oj.erase("element1");
CHECK(j.dump() == "{\"element2\":2,\"element3\":3}");
CHECK(oj.dump() == "{\"element3\":3,\"element2\":2}");
// There are no dup keys cause constructor calls emplace... // There are no dup keys cause constructor calls emplace...
json multi {{"z", 1}, {"m", 2}, {"m", 3}, {"y", 4}, {"m", 5}}; json multi {{"z", 1}, {"m", 2}, {"m", 3}, {"y", 4}, {"m", 5}};
CHECK(multi.size() == 3); CHECK(multi.size() == 3);