virtual void SetUp() { myArray->push( 80 ); myArray->push( 4 ); myArray1->push( 80 ); myArray1->push( 2 ); myArray1->popFront(); myArray1->push( 5 ); myArray1->push( 4 ); myArray1->push( 100 ); myArray1->push( 8 ); myArray1->push( 3 ); for( int i = 0; i < 12; i++ ) { myArray2->pushFront( i ); } for( int i = 0; i < 11; i++ ) { myArray3->push( 2 ); } //myArray4=myArray; // this functionality mostly works, but has memory leaks }
TEST( DynamicArray, getLength ) { StevensDev::sgdc::DynamicArray<int> array; EXPECT_EQ( 0, array.getLength() ); array.push(0); array.push(1); array.push(2); array.push(3); EXPECT_EQ( 4, array.getLength() ); array.push(4); array.push(5); array.push(6); array.push(7); EXPECT_EQ( 8, array.getLength() ); array.push(8); array.push(9); array.push(10); EXPECT_EQ( 11, array.getLength() ); }
TEST( DynamicArray, popFront ) { StevensDev::sgdc::DynamicArray<int> array; array.push(0); array.push(1); array.push(2); array.push(3); array.push(4); array.push(5); array.push(6); array.push(7); array.push(8); array.push(9); array.push(10); EXPECT_EQ( 0, array.popFront() ); EXPECT_EQ( 1, array.popFront() ); EXPECT_EQ( 2, array.popFront() ); }
TEST( DynamicArray, pop ) { StevensDev::sgdc::DynamicArray<int> array; array.push(0); array.push(1); array.push(2); array.push(3); array.push(4); array.push(5); array.push(6); array.push(7); array.push(8); array.push(9); array.push(10); EXPECT_EQ( 10, array.pop() ); EXPECT_EQ( 9, array.pop() ); EXPECT_EQ( 8, array.pop() ); }
TEST( DynamicArray, brackets ) { StevensDev::sgdc::DynamicArray<int> array; array.push(0); array.push(1); array.push(2); array.push(3); array.push(4); array.push(5); array.push(6); array.push(7); array.push(8); array.push(9); array.push(10); EXPECT_EQ( 1, array[1] ); EXPECT_EQ( 2, array[2] ); EXPECT_EQ( 7, array[7] ); }
TEST( DynamicArray, push ) { StevensDev::sgdc::DynamicArray<int> array; array.push(0); array.push(1); array.push(2); array.push(3); array.push(4); array.push(5); array.push(6); array.push(7); array.push(8); array.push(9); array.push(10); EXPECT_EQ( 0, array.at( 0 ) ); EXPECT_EQ( 1, array.at( 1 ) ); EXPECT_EQ( 2, array.at( 2 ) ); EXPECT_EQ( 7, array.at( 7 ) ); }