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
    }
Example #2
0
TEST( DynamicArray, pushFront ) {
    StevensDev::sgdc::DynamicArray<int> array;
    
    array.pushFront(0);
    array.pushFront(1);
    array.pushFront(2);
    array.pushFront(3);
    array.pushFront(4);
    array.pushFront(5);
    array.pushFront(6);
    array.pushFront(7);
    array.pushFront(8);
    array.pushFront(9);
    array.pushFront(10);
    
    EXPECT_EQ( 10, array.at( 0 ) );
    EXPECT_EQ( 9 , array.at( 1 ) );
    EXPECT_EQ( 8 , array.at( 2 ) );
    EXPECT_EQ( 1, array.at( 9 ) );
}
Example #3
0
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() );
}
Example #4
0
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() );
}
Example #5
0
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 ) );
}
Example #6
0
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] );
}
Example #7
0
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() );
}