From 9923219ce7e1f791b079ecaf21cb20d0938f8d6a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 1 May 2021 18:29:26 +0100 Subject: Common implementation for shared and unique pointers --- test/fixtures/json/shared_ptr3.json | 8 ++++++++ test/test-persistence.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/fixtures/json/shared_ptr3.json (limited to 'test') diff --git a/test/fixtures/json/shared_ptr3.json b/test/fixtures/json/shared_ptr3.json new file mode 100644 index 0000000..69f5e85 --- /dev/null +++ b/test/fixtures/json/shared_ptr3.json @@ -0,0 +1,8 @@ +{ + "@typeid": "SharedTestObject", + "sptr": { + "@typeid": "SubObject", + "@id": "someid" + }, + "ssptr": {} +} diff --git a/test/test-persistence.cpp b/test/test-persistence.cpp index 6dcb94d..523ca41 100644 --- a/test/test-persistence.cpp +++ b/test/test-persistence.cpp @@ -215,6 +215,14 @@ BOOST_FIXTURE_TEST_CASE(load_shared_object2, JPP) BOOST_CHECK_EQUAL(to->ssptr.use_count(), 2); } +BOOST_FIXTURE_TEST_CASE(load_shared_object3, JPP) +{ + auto to = load_json>(FIXTURESDIR "json/shared_ptr3.json"); + BOOST_CHECK(to->sptr); + BOOST_CHECK(to->ssptr); + BOOST_CHECK_NE(to->sptr, to->ssptr); +} + BOOST_FIXTURE_TEST_CASE(load_shared_object_null, JPP) { auto to = load_json>(FIXTURESDIR "json/shared_ptr_null.json"); -- cgit v1.2.3