Test std::unique_ptr in generated code
This commit is contained in:
parent
683d87c366
commit
c71a9baa54
|
@ -128,8 +128,8 @@ void JsonGeneratorTests::testNesting()
|
||||||
NestedTestStruct nested;
|
NestedTestStruct nested;
|
||||||
nested.nested.emplace_front(vector<TestStruct>{ test });
|
nested.nested.emplace_front(vector<TestStruct>{ test });
|
||||||
nested.deq.emplace_back(3.14);
|
nested.deq.emplace_back(3.14);
|
||||||
const string expectedJSON(
|
const string expectedJSON("{\"nested\":[[{\"someInt\":42,\"someString\":\"the answer\",\"yetAnotherString\":\"but what was the "
|
||||||
"{\"nested\":[[{\"someInt\":42,\"someString\":\"the answer\",\"yetAnotherString\":\"but what was the question\"}]],\"deq\":[3.14]}");
|
"question\"}]],\"ptr\":null,\"deq\":[3.14]}");
|
||||||
|
|
||||||
// test serialization
|
// test serialization
|
||||||
CPPUNIT_ASSERT_EQUAL(expectedJSON, string(nested.toJson().GetString()));
|
CPPUNIT_ASSERT_EQUAL(expectedJSON, string(nested.toJson().GetString()));
|
||||||
|
|
|
@ -39,6 +39,7 @@ struct NestedTestStruct : public JsonSerializable<NestedTestStruct> {
|
||||||
friend class JsonGeneratorTests;
|
friend class JsonGeneratorTests;
|
||||||
|
|
||||||
list<vector<TestStruct>> nested;
|
list<vector<TestStruct>> nested;
|
||||||
|
unique_ptr<TestStruct> ptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
deque<double> deq;
|
deque<double> deq;
|
||||||
|
|
Loading…
Reference in New Issue