Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/tests/BLI_serialize_test.cc
| Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | TEST(serialize, array_to_json) | ||||
| json.serialize(out, value_array); | json.serialize(out, value_array); | ||||
| EXPECT_EQ(out.str(), "[42,\"Hello JSON\",null,false,true]"); | EXPECT_EQ(out.str(), "[42,\"Hello JSON\",null,false,true]"); | ||||
| } | } | ||||
| TEST(serialize, object_to_json) | TEST(serialize, object_to_json) | ||||
| { | { | ||||
| JsonFormatter json; | JsonFormatter json; | ||||
| std::stringstream out; | std::stringstream out; | ||||
| ObjectValue value_object; | DictionaryValue value_object; | ||||
| ObjectValue::Items &attributes = value_object.elements(); | DictionaryValue::Items &attributes = value_object.elements(); | ||||
| attributes.append_as(std::pair(std::string("best_number"), new IntValue(42))); | attributes.append_as(std::pair(std::string("best_number"), new IntValue(42))); | ||||
| json.serialize(out, value_object); | json.serialize(out, value_object); | ||||
| EXPECT_EQ(out.str(), "{\"best_number\":42}"); | EXPECT_EQ(out.str(), "{\"best_number\":42}"); | ||||
| } | } | ||||
| TEST(serialize, json_roundtrip_ordering) | TEST(serialize, json_roundtrip_ordering) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines | |||||