コード例 #1
0
TEST_F( SimplexSupportDoublyLinkedList, RemoveAtReturnsValue )
{
    MockStruct* m1 = new MockStruct();
    MockStruct* m2 = new MockStruct();

    DoublyLinkedList list;

    list.PushBack(m1);
    list.PushBack(m2);

    MockStruct* result = (MockStruct*) list.RemoveAt(1);

    ASSERT_EQ(result, m2);

    delete(m1);
    delete(m2);
}
コード例 #2
0
//
//  RemoveAt
//
TEST_F( SimplexSupportDoublyLinkedList, RemoveAtLeavesAConsistentList )
{
    MockStruct* m1 = new MockStruct();
    MockStruct* m2 = new MockStruct();
    MockStruct* m3 = new MockStruct();

    DoublyLinkedList list;

    list.PushBack(m1);
    list.PushBack(m2);
    list.PushBack(m3);

    list.RemoveAt(1);

    ASSERT_EQ((MockStruct*)list.First()->Next->Value, m3);
    ASSERT_EQ((MockStruct*)list.Last()->Previous->Value, m1);

    delete(m1);
    delete(m2);
    delete(m3);
}