MCPcopy Create free account
hub / github.com/catboost/catboost / TestListWithAutoDeleteClear

Method TestListWithAutoDeleteClear

util/generic/intrlist_ut.cpp:455–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455void TListTest::TestListWithAutoDeleteClear() {
456 using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>;
457 int counter{0};
458 {
459 TListType lst;
460 UNIT_ASSERT(lst.Empty());
461 lst.PushFront(new TSelfCountingInt(counter, 2));
462 UNIT_ASSERT_EQUAL(lst.Size(), 1);
463 UNIT_ASSERT_EQUAL(counter, 1);
464 lst.PushFront(new TSelfCountingInt(counter, 1));
465 UNIT_ASSERT_EQUAL(lst.Size(), 2);
466 UNIT_ASSERT_EQUAL(counter, 2);
467 CheckList(lst);
468
469 lst.Clear();
470 UNIT_ASSERT(lst.Empty());
471 UNIT_ASSERT_EQUAL(counter, 0);
472 lst.PushFront(new TSelfCountingInt(counter, 1));
473 UNIT_ASSERT_EQUAL(lst.Size(), 1);
474 }
475
476 UNIT_ASSERT_EQUAL(counter, 0);
477}
478
479struct TSecondTag {};
480

Callers

nothing calls this directly

Calls 5

CheckListFunction · 0.85
EmptyMethod · 0.45
PushFrontMethod · 0.45
SizeMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected