Test std::unique_ptr in generated code

This commit is contained in:
Martchus 2017-11-13 16:18:32 +01:00
parent 683d87c366
commit c71a9baa54
2 changed files with 3 additions and 2 deletions

View File

@ -128,8 +128,8 @@ void JsonGeneratorTests::testNesting()
NestedTestStruct nested;
nested.nested.emplace_front(vector<TestStruct>{ test });
nested.deq.emplace_back(3.14);
const string expectedJSON(
"{\"nested\":[[{\"someInt\":42,\"someString\":\"the answer\",\"yetAnotherString\":\"but what was the question\"}]],\"deq\":[3.14]}");
const string expectedJSON("{\"nested\":[[{\"someInt\":42,\"someString\":\"the answer\",\"yetAnotherString\":\"but what was the "
"question\"}]],\"ptr\":null,\"deq\":[3.14]}");
// test serialization
CPPUNIT_ASSERT_EQUAL(expectedJSON, string(nested.toJson().GetString()));

View File

@ -39,6 +39,7 @@ struct NestedTestStruct : public JsonSerializable<NestedTestStruct> {
friend class JsonGeneratorTests;
list<vector<TestStruct>> nested;
unique_ptr<TestStruct> ptr;
private:
deque<double> deq;