| 311 | |
| 312 | template <typename MMType> |
| 313 | void MMTypeTest<MMType>::testSerializationBasic(Config config) { |
| 314 | // add some nodes to the container and ensure that they are marked |
| 315 | // accessible and can be traversed through the eviction iterator. |
| 316 | Container c1(config, {}); |
| 317 | std::vector<std::unique_ptr<Node>> nodes; |
| 318 | createSimpleContainer(c1, nodes); |
| 319 | |
| 320 | testAddBasic(c1, nodes); |
| 321 | |
| 322 | // save state and restore |
| 323 | auto serializedData = c1.saveState(); |
| 324 | |
| 325 | // c2 should behave the same as c1 |
| 326 | Container c2(serializedData, {}); |
| 327 | ASSERT_EQ(c2.getStats().size, nodes.size()); |
| 328 | |
| 329 | for (auto& node : nodes) { |
| 330 | bool foundNode = false; |
| 331 | for (auto it = c2.getEvictionIterator(); it; ++it) { |
| 332 | if (&*node == &*it) { |
| 333 | foundNode = true; |
| 334 | break; |
| 335 | } |
| 336 | } |
| 337 | verifyIterationVariants(c2); |
| 338 | ASSERT_TRUE(foundNode); |
| 339 | foundNode = false; |
| 340 | } |
| 341 | |
| 342 | testAddBasic(c2, nodes); |
| 343 | } |
| 344 | |
| 345 | template <typename MMType> |
| 346 | size_t MMTypeTest<MMType>::getListSize(const Container& c, |
nothing calls this directly
no test coverage detected