| 393 | }; |
| 394 | |
| 395 | void TListTest::TestListWithAutoDelete() { |
| 396 | using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>; |
| 397 | int counter{0}; |
| 398 | { |
| 399 | TListType lst; |
| 400 | UNIT_ASSERT(lst.Empty()); |
| 401 | lst.PushFront(new TSelfCountingInt(counter, 2)); |
| 402 | UNIT_ASSERT_EQUAL(lst.Size(), 1); |
| 403 | UNIT_ASSERT_EQUAL(counter, 1); |
| 404 | lst.PushFront(new TSelfCountingInt(counter, 1)); |
| 405 | UNIT_ASSERT_EQUAL(lst.Size(), 2); |
| 406 | UNIT_ASSERT_EQUAL(counter, 2); |
| 407 | CheckList(lst); |
| 408 | } |
| 409 | |
| 410 | UNIT_ASSERT_EQUAL(counter, 0); |
| 411 | } |
| 412 | |
| 413 | void TListTest::TestListWithAutoDeleteMoveCtor() { |
| 414 | using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>; |