diff --git a/tests/json_deserial.test.cpp b/tests/json_deserial.test.cpp index e98a97b..bf3db12 100644 --- a/tests/json_deserial.test.cpp +++ b/tests/json_deserial.test.cpp @@ -369,7 +369,25 @@ namespace }; "array"_test = [] { + adv_check_object_deserial(R"({"field_0": [1, 2, 3]})", [](const auto& lhs) { return lhs->field_0 == std::vector({1, 2, 3}); }); + adv_check_object_deserial(R"({"field_0": 2137, "field_1": [1, 2, 3]})", [](const auto& lhs) { + return lhs->field_0 == 2137 && lhs->field_1 == std::vector({1, 2, 3}); + }); + + adv_check_object_deserial(R"({"field_0": [{"field_0": 1}, {"field_0": 2}, {"field_0": 3}]})", [](const auto& lhs) { + int i = 1; + for(const auto& x: lhs->field_0) + if(x.field_0 != i++) return false; + return true; + }); + + adv_check_object_deserial(R"({"field_0": 2137, "field_1": [{"field_0": 1}, {"field_0": 2}, {"field_0": 3}]})", [](const auto& lhs) { + int i = 1; + for(const auto& x: lhs->field_1) + if(x.field_0 != i++) return false; + return lhs->field_0 == 2137; + }); }; }; } // namespace