diff --git a/tests/unit/test_footprinter.cc b/tests/unit/test_footprinter.cc index 8ae2a2c0..7d984372 100644 --- a/tests/unit/test_footprinter.cc +++ b/tests/unit/test_footprinter.cc @@ -598,6 +598,11 @@ struct TestNoSerialize { int i; }; +static_assert( + not SerializableTraits::is_traversable, + "TestNoSerialize has no serializer defined" +); + TEST_F(TestFootprinter, test_no_serialize) { std::vector v(7); @@ -605,5 +610,16 @@ TEST_F(TestFootprinter, test_no_serialize) { checkpoint::getMemoryFootprint(v), sizeof(v) + v.capacity() * sizeof(TestNoSerialize) ); + + std::unordered_map m; + m[1] = TestNoSerialize(); + m[2] = TestNoSerialize(); + m[3] = TestNoSerialize(); + auto p = *m.begin(); + + EXPECT_EQ( + checkpoint::getMemoryFootprint(m), + sizeof(m) + m.size() * (sizeof(p) + sizeof(p.first) + sizeof(p.second)) + ); } }}} // end namespace checkpoint::tests::unit