TEST_F( SimplexSupportDoublyLinkedList, PopBackUpdatesFirstWhenListIsEmptied ) { MockStruct* m = new MockStruct(); DoublyLinkedList list; list.PushBack( m ); list.PopBack(); ASSERT_EQ ( list.First(), nullptr ); delete(m); }
TEST_F( SimplexSupportDoublyLinkedList, PopBackReturnsObject ) { MockStruct* m1 = new MockStruct(); DoublyLinkedList list; list.PushBack(m1); MockStruct*m2 = (MockStruct*) list.PopBack(); ASSERT_EQ(m2, m1); delete(m1); }
TEST_F( SimplexSupportDoublyLinkedList, PopBackDeallocatesNode ) { MockStruct* m = new MockStruct(); DoublyLinkedList list; list.PushBack(m); ASSERT_EQ(mAllocator->GetAllocationCount(), 1); list.PopBack(); ASSERT_EQ(mAllocator->GetAllocationCount(), 0); ASSERT_EQ(mAllocator->GetUsedMemory(), 0); delete(m); }