Exemplo n.º 1
0
// Test case 2: insertAtBack
TEST(TestInsert, insertAtBack) {
	StringLinkedList l;
	l.insert(0, "A");
	EXPECT_EQ("A", l.toString());

	l.insert(1, "B");
	EXPECT_EQ("A->B", l.toString());

	l.insert(2, "C");
	EXPECT_EQ("A->B->C", l.toString());
}
Exemplo n.º 2
0
// Test case 1: insertAtFront
TEST(TestInsert, insertAtFront) {
	StringLinkedList l;
	l.insert(0, "A");
	EXPECT_EQ("A", l.toString());

	l.insert(0, "B");
	EXPECT_EQ("B->A", l.toString());

	l.insert(0, "C");
	EXPECT_EQ("C->B->A", l.toString());
}
Exemplo n.º 3
0
// Test case 3: insertAtMiddle
TEST(TestInsert, insertAtMiddle) {
	StringLinkedList l;
	l.insert(0, "A");
	l.insert(1, "B");
	EXPECT_EQ("A->B", l.toString());

	l.insert(1, "C");
	EXPECT_EQ("A->C->B", l.toString());

	l.insert(1, "D");
	EXPECT_EQ("A->D->C->B", l.toString());

	l.insert(2, "E");
	EXPECT_EQ("A->D->E->C->B", l.toString());
}
Exemplo n.º 4
0
TEST(TestConstructor, defaultConstructor) {
	StringLinkedList l;
	EXPECT_EQ("", l.toString());
}