activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1050221 [6/8] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/cmsutil/ main/activemq/core/ main/activemq/state/ main/activemq/threads/ main/activemq/transport/ main/activemq/transport/failover/ main/activemq/util/ m...
Date Thu, 16 Dec 2010 23:18:06 GMT
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArrayListTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArrayListTest.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArrayListTest.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArrayListTest.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,859 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ArrayListTest.h"
+
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#include <decaf/util/ArrayList.h>
+#include <decaf/util/StlList.h>
+#include <decaf/lang/Integer.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+const int ArrayListTest::SIZE = 256;
+
+////////////////////////////////////////////////////////////////////////////////
+namespace {
+
+    void populate( ArrayList<int>& list, int n ) {
+
+        CPPUNIT_ASSERT( list.isEmpty() );
+
+        for( int i = 0; i < n; ++i ) {
+            list.add( i );
+        }
+
+        CPPUNIT_ASSERT( !list.isEmpty());
+        CPPUNIT_ASSERT_EQUAL( n, list.size() );
+    }
+
+    void populate( ArrayList<std::string>& list, int n ) {
+
+        CPPUNIT_ASSERT( list.isEmpty() );
+
+        for( int i = 0; i < n; ++i ) {
+            list.add( Integer::toString( i ) );
+        }
+
+        CPPUNIT_ASSERT( !list.isEmpty());
+        CPPUNIT_ASSERT_EQUAL( n, list.size() );
+    }
+
+    void populate( std::vector<int>& list, int n ) {
+
+        CPPUNIT_ASSERT( list.empty() );
+
+        for( int i = 0; i < n; ++i ) {
+            list.push_back( i );
+        }
+
+        CPPUNIT_ASSERT( !list.empty());
+        CPPUNIT_ASSERT_EQUAL( n, (int)list.size() );
+    }
+
+    template< typename E>
+    class MockArrayList : public ArrayList<E> {
+    public:
+
+        MockArrayList() : ArrayList<E>() {
+        }
+
+        virtual ~MockArrayList() {}
+
+        virtual int size() const {
+            return 0;
+        }
+    };
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ArrayListTest::ArrayListTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ArrayListTest::~ArrayListTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testConstructor1() {
+
+    ArrayList<int> array;
+    CPPUNIT_ASSERT( array.isEmpty() );
+    CPPUNIT_ASSERT( array.size() == 0 );
+
+    ArrayList<std::string> strArray;
+    CPPUNIT_ASSERT( strArray.isEmpty() );
+    CPPUNIT_ASSERT( strArray.size() == 0 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testConstructor2() {
+
+    StlList<int> intsList;
+
+    for( int i = 0; i < SIZE; ++i ) {
+        intsList.add( i );
+    }
+
+    ArrayList<int> array( intsList );
+    CPPUNIT_ASSERT( !array.isEmpty() );
+    CPPUNIT_ASSERT( array.size() == SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT_EQUAL( intsList.get( i ), array.get( i ) );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testClear() {
+
+    ArrayList<int> array( 100 );
+    CPPUNIT_ASSERT_MESSAGE( "List size should be zero", 0 == array.size() );
+    CPPUNIT_ASSERT_MESSAGE( "List should indicate its empty", array.isEmpty() );
+    array.add( 25 );
+    array.clear();
+    CPPUNIT_ASSERT_MESSAGE( "List size should be zero", 0 == array.size() );
+    CPPUNIT_ASSERT_MESSAGE( "List should indicate its empty", array.isEmpty() );
+
+    ArrayList<int> array1;
+    CPPUNIT_ASSERT_MESSAGE( "List size should be zero", 0 == array1.size() );
+    CPPUNIT_ASSERT_MESSAGE( "List should indicate its empty", array1.isEmpty() );
+    array1.add( 25 );
+    array1.clear();
+    CPPUNIT_ASSERT_MESSAGE( "List size should be zero", 0 == array1.size() );
+    CPPUNIT_ASSERT_MESSAGE( "List should indicate its empty", array1.isEmpty() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testConstructor3() {
+
+    ArrayList<int> array( 100 );
+    CPPUNIT_ASSERT( array.isEmpty() );
+    CPPUNIT_ASSERT( array.size() == 0 );
+
+    ArrayList<std::string> strArray( 42 );
+    CPPUNIT_ASSERT( strArray.isEmpty() );
+    CPPUNIT_ASSERT( strArray.size() == 0 );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAdd1() {
+
+    ArrayList<int> array( 100 );
+    array.add( 25 );
+    CPPUNIT_ASSERT_MESSAGE( "Failed to add Object", array.get( 0 ) == 25 );
+
+    ArrayList<int> array1;
+    array1.add( 25 );
+    CPPUNIT_ASSERT_MESSAGE( "Failed to add Object", array1.get( 0 ) == 25 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IllegalArgumentException",
+        ArrayList<int>( -1 ),
+        IllegalArgumentException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAdd2() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+    std::vector<int> mirror;
+    populate( mirror, SIZE );
+
+    array.add( 50, 42 );
+    CPPUNIT_ASSERT_MESSAGE( "Failed to add Object", array.get( 50 ) == 42 );
+    CPPUNIT_ASSERT_MESSAGE( "Failed to fix up list after insert",
+                            array.get( 51 ) == mirror[50] && ( array.get( 52 ) == mirror[51] ) );
+    int oldItem = array.get( 25 );
+    array.add( 25, 0 );
+    CPPUNIT_ASSERT_MESSAGE( "Should have returned zero", array.get( 25 ) == 0 );
+    CPPUNIT_ASSERT_MESSAGE( "Should have returned the old item from slot 25", array.get( 26 ) == oldItem );
+
+    array.add( 0, 84 );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Failed to add Object", array.get( 0 ), 84 );
+    CPPUNIT_ASSERT_EQUAL( array.get( 1 ), mirror[0] );
+    CPPUNIT_ASSERT_EQUAL( array.get( 2 ), mirror[1] );
+
+    oldItem = array.get( 0 );
+    array.add( 0, 0 );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Should have returned null", 0, array.get( 0 ) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Should have returned the old item from slot 0", array.get( 1 ), oldItem );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        array.add( -1, 0 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        array.add( array.size() + 1, 0 ),
+        IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAdd3() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+    std::vector<int> mirror;
+    populate( mirror, SIZE );
+
+    int size = array.size();
+    array.add( size, 42 );
+    CPPUNIT_ASSERT( array.size() == SIZE + 1 );
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Failed to add Object", array.get( size ), 42 );
+    CPPUNIT_ASSERT_EQUAL( array.get( size - 2 ), mirror[size - 2] );
+    CPPUNIT_ASSERT_EQUAL( array.get( size - 1 ), mirror[size - 1] );
+
+    array.removeAt( size );
+    CPPUNIT_ASSERT( array.size() == SIZE );
+
+    size = array.size();
+    array.add( size, 0 );
+    CPPUNIT_ASSERT( array.size() == SIZE + 1 );
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Should have returned 0", 0, array.get( size ) );
+    CPPUNIT_ASSERT_EQUAL( array.get( size - 2 ), mirror[size - 2] );
+    CPPUNIT_ASSERT_EQUAL( array.get( size - 1 ), mirror[size - 1] );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAddAll1() {
+
+    ArrayList<int> array;
+    populate( array, 100 );
+    std::vector<int> mirror;
+    populate( mirror, 100 );
+
+    array.addAll( 50, array );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Returned incorrect size after adding to existing list", 200, array.size() );
+
+    for( int i = 0; i < 50; i++ ) {
+        CPPUNIT_ASSERT_MESSAGE( "Manipulated elements < index", array.get( i ) == mirror[i] );
+    }
+
+    for( int i = 0; i >= 50 && ( i < 150 ); i++ ) {
+        CPPUNIT_ASSERT_MESSAGE( "Failed to ad elements properly", array.get( i ) == mirror[i - 50] );
+    }
+
+    for( int i = 0; i >= 150 && ( i < 200 ); i++ ) {
+        CPPUNIT_ASSERT_MESSAGE( "Failed to ad elements properly", array.get( i ) == mirror[i - 100] );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAddAll2() {
+
+    StlList<int> emptyCollection;
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        ArrayList<int>().addAll( -1, emptyCollection ),
+        IndexOutOfBoundsException );
+
+    {
+        std::string data[] = { "1", "2", "3", "4", "5", "6", "7", "8" };
+        ArrayList<std::string> list1;
+        ArrayList<std::string> list2;
+        for( int i = 0; i < 8; ++i ) {
+            list1.add( data[i] );
+            list2.add( data[i] );
+            list2.add( data[i] );
+        }
+
+        while( list1.size() > 0 ) {
+            list1.removeAt( 0 );
+        }
+        list1.addAll( list2 );
+        CPPUNIT_ASSERT_MESSAGE( "The object list is not the same as original list",
+                                list1.containsAll( list2 ) && list2.containsAll( list1 ) );
+
+        ArrayList<std::string> list3;
+        for( int i = 0; i < 100; i++ ) {
+            if( list1.size() > 0 ) {
+                list3.removeAll( list1 );
+                list3.addAll( list1 );
+            }
+        }
+        CPPUNIT_ASSERT_MESSAGE( "The object list is not the same as original list",
+                                list3.containsAll( list1 ) && list1.containsAll( list3 ) );
+    }
+    {
+        ArrayList<std::string> list1;
+        ArrayList<std::string> list2;
+        int location = 2;
+
+        std::string data1[] = { "1", "2", "3", "4", "5", "6" };
+        std::string data2[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+        for( int i = 0; i < 6; i++ ) {
+            list1.add( data1[i] );
+        }
+        for( int i = 0; i < 8; i++ ) {
+            list2.add( data2[i] );
+        }
+
+        list1.removeAt( location );
+        list1.addAll( location, list2 );
+
+        // Inserted elements should be equal to second array
+        for( int i = 0; i < 8; i++ ) {
+            CPPUNIT_ASSERT_EQUAL( data2[i], list1.get( location + i ) );
+        }
+        // Elements after inserted location should
+        // be equals to related elements in first array
+        for( int i = location + 1; i < 6; i++ ) {
+            CPPUNIT_ASSERT_EQUAL( data1[i], list1.get( i + 8 - 1 ) );
+        }
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAddAll3() {
+
+    ArrayList<int> list;
+    list.addAll( 0, list );
+    list.addAll( list.size(), list );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        list.addAll( -1, list ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        list.addAll( list.size() + 1, list ),
+        IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAddAll4() {
+
+    ArrayList<std::string> array;
+    ArrayList<std::string> blist;
+
+    array.add( "a" );
+    array.add( "b" );
+    blist.add( "c" );
+    blist.add( "d" );
+    blist.removeAt( 0 );
+    blist.addAll( 0, array );
+
+    CPPUNIT_ASSERT_EQUAL( std::string("a"), blist.get(0) );
+    CPPUNIT_ASSERT_EQUAL( std::string("b"), blist.get(1) );
+    CPPUNIT_ASSERT_EQUAL( std::string("d"), blist.get(2) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAddAll5() {
+
+    ArrayList<std::string> array;
+    populate( array, 100 );
+
+    ArrayList<std::string> l;
+    l.addAll( array );
+    for( int i = 0; i < array.size(); i++ ) {
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( "Failed to add elements properly",
+                                      l.get(i), array.get( i ) );
+    }
+    array.addAll( array );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Returned incorrect size after adding to existing list",
+                                  200, array.size());
+
+    for( int i = 0; i < 100; i++ ) {
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( "Added to list in incorrect order",
+                                      array.get(i), l.get(i) );
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( "Failed to add to existing list",
+                                      array.get(i + 100), l.get(i) );
+    }
+
+    ArrayList<int> originalList( 12 );
+    for( int j = 0; j < 12; j++ ) {
+        originalList.add( j );
+    }
+
+    originalList.removeAt( 0 );
+    originalList.removeAt( 0 );
+
+    ArrayList<int> additionalList( 11 );
+    for( int j = 0; j < 11; j++ ) {
+        additionalList.add( j );
+    }
+    CPPUNIT_ASSERT( originalList.addAll( additionalList ) );
+    CPPUNIT_ASSERT_EQUAL( 21, originalList.size() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAddAll6() {
+
+    ArrayList<int> arrayListA;
+    arrayListA.add( 1 );
+    ArrayList<int> arrayListB;
+    arrayListB.add( 1 );
+    arrayListA.addAll( 1, arrayListB );
+    int size = arrayListA.size();
+    CPPUNIT_ASSERT_EQUAL( 2, size );
+    for( int index = 0; index < size; index++ ) {
+        CPPUNIT_ASSERT_EQUAL( 1, arrayListA.get( index ) );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAddAll7() {
+
+    ArrayList<int> arrayList;
+    arrayList.add( 1 );
+    arrayList.addAll( 1, arrayList );
+    int size = arrayList.size();
+    CPPUNIT_ASSERT_EQUAL( 2, size );
+    for( int index = 0; index < size; index++ ) {
+        CPPUNIT_ASSERT_EQUAL( 1, arrayList.get( index ) );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAddAll8() {
+
+    ArrayList<std::string> arrayList;
+    arrayList.add( "1" );
+    arrayList.add( "2" );
+
+    ArrayList<std::string> list;
+    list.add( "a" );
+    list.add( 0, "b" );
+    list.add( 0, "c" );
+    list.add( 0, "d" );
+    list.add( 0, "e" );
+    list.add( 0, "f" );
+    list.add( 0, "g" );
+    list.add( 0, "h" );
+    list.add( 0, "i" );
+
+    list.addAll( 6, arrayList );
+
+    CPPUNIT_ASSERT_EQUAL( 11, list.size() );
+    CPPUNIT_ASSERT( !list.contains( "q" ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testAddAll9() {
+
+    ArrayList<std::string> list;
+    list.add( "one" );
+    list.add( "two" );
+    CPPUNIT_ASSERT_EQUAL( 2, list.size() );
+
+    list.removeAt( 0 );
+    CPPUNIT_ASSERT_EQUAL( 1, list.size() );
+
+    ArrayList<std::string> collection;
+    collection.add( "1" );
+    collection.add( "2" );
+    collection.add( "3" );
+    CPPUNIT_ASSERT_EQUAL( 3, collection.size() );
+
+    list.addAll( 0, collection );
+    CPPUNIT_ASSERT_EQUAL( 4, list.size() );
+
+    list.removeAt( 0 );
+    list.removeAt( 0 );
+    CPPUNIT_ASSERT_EQUAL( 2, list.size() );
+
+    collection.add( "4" );
+    collection.add( "5" );
+    collection.add( "6" );
+    collection.add( "7" );
+    collection.add( "8" );
+    collection.add( "9" );
+    collection.add( "10" );
+    collection.add( "11" );
+    collection.add( "12" );
+
+    CPPUNIT_ASSERT_EQUAL( 12, collection.size() );
+
+    list.addAll( 0, collection );
+    CPPUNIT_ASSERT_EQUAL( 14, list.size() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testContains() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+    std::vector<int> mirror;
+    populate( mirror, SIZE );
+
+    CPPUNIT_ASSERT_MESSAGE( "Returned false for valid element",
+                            array.contains( mirror[ 99 ] ) );
+    CPPUNIT_ASSERT_MESSAGE( "Returned false for equal element",
+                            array.contains( 8 ) );
+    CPPUNIT_ASSERT_MESSAGE( "Returned true for invalid element",
+                            !array.contains( 9999 ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testEnsureCapacity() {
+
+    int capacity = 20;
+    int testValue = 2048;
+    ArrayList<int> array( capacity );
+    int i;
+
+    for( i = 0; i < capacity / 2; i++ ) {
+        array.add( i, i + 44 );
+    }
+
+    array.add( i, testValue );
+    int location = array.indexOf( testValue );
+    array.ensureCapacity( capacity );
+    CPPUNIT_ASSERT_MESSAGE( "EnsureCapacity moved objects around in array1.",
+                            location == array.indexOf( testValue ) );
+    array.removeAt( 0 );
+    array.ensureCapacity( capacity );
+    CPPUNIT_ASSERT_MESSAGE( "EnsureCapacity moved objects around in array2.",
+                            --location == array.indexOf(testValue));
+    array.ensureCapacity( capacity + 2 );
+    CPPUNIT_ASSERT_MESSAGE( "EnsureCapacity did not change location.",
+                            location == array.indexOf(testValue));
+
+    ArrayList<std::string> list( 1 );
+    list.add( "hello" );
+    list.ensureCapacity( Integer::MIN_VALUE );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testGet() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+    std::vector<int> mirror;
+    populate( mirror, SIZE );
+
+    CPPUNIT_ASSERT_MESSAGE( "Returned incorrect element", array.get(22) == mirror[22] );
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        array.get( 9999 ),
+        IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testIndexOf() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+    std::vector<int> mirror;
+    populate( mirror, SIZE );
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Returned incorrect index", 87, array.indexOf( mirror[87] ) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Returned index for invalid Object", -1, array.indexOf( SIZE + 10 ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testIsEmpty() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+
+    CPPUNIT_ASSERT_MESSAGE( "isEmpty returned false for new list", ArrayList<int>( 10 ).isEmpty() );
+    CPPUNIT_ASSERT_MESSAGE("Returned true for existing list with elements", !array.isEmpty() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testLastIndexOf() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+
+    array.add( 99 );
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect index", SIZE, array.lastIndexOf( 99 ) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned index for invalid Object", -1, array.lastIndexOf( 2048 ) );
+
+    array.trimToSize();
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect index", SIZE, array.lastIndexOf( 99 ) );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testRemove() {
+
+    ArrayList<int> list1;
+    populate( list1, SIZE );
+    ArrayList<int> list2;
+    populate( list2, SIZE );
+
+    list1.remove( 42 );
+    list2.remove( 42 );
+
+    CPPUNIT_ASSERT_MESSAGE( "Lists should be equal", list1.equals( list2 ) );
+    list1.remove( 42 );
+    CPPUNIT_ASSERT_MESSAGE( "Lists should be equal", list1.equals( list2 ) );
+
+    CPPUNIT_ASSERT( list1.remove( 0 ) );
+    CPPUNIT_ASSERT_MESSAGE( "Lists should not be equal", !list1.equals( list2 ) );
+
+    list1.clear();
+    populate( list1, SIZE );
+
+    for( int i = 0; i < SIZE; i++ ) {
+        CPPUNIT_ASSERT( list1.remove( i ) );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testRemoveAt() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+
+    array.removeAt( 10 );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to remove element", -1, array.indexOf( 10 ) );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        array.removeAt( 9999 ),
+        IndexOutOfBoundsException );
+
+    ArrayList<int> myArray( array );
+    array.add( 25, 9999 );
+    array.add( 50, 9999 );
+    array.removeAt( 50 );
+    array.removeAt( 25 );
+    CPPUNIT_ASSERT_MESSAGE("Removing index did not work", array.equals( myArray ) );
+
+    std::string data[] = { "a", "b", "c", "d", "e", "f", "g" };
+    ArrayList<std::string> list;
+    for( int i = 0; i < 7; ++i ) {
+        list.add( data[i] );
+    }
+
+    CPPUNIT_ASSERT_MESSAGE( "Removed wrong element 1", list.removeAt(0) == "a" );
+    CPPUNIT_ASSERT_MESSAGE( "Removed wrong element 2", list.removeAt(4) == "f" );
+
+    ArrayList<int> l( 0 );
+    l.add( 5 );
+    l.add( 6 );
+    l.removeAt( 0 );
+    l.removeAt( 0 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        l.removeAt( -1 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        l.removeAt( 0 ),
+        IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testSet() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+
+    array.set( 65, 42 );
+
+    CPPUNIT_ASSERT_MESSAGE( "Failed to set object", array.get( 65 ) == 42 );
+    array.set( 50, 0 );
+    CPPUNIT_ASSERT_MESSAGE( "Setting to null did not work", 0 == array.get( 50 ) );
+    CPPUNIT_ASSERT_MESSAGE( std::string("") + "Setting increased the list's size to: " +
+                            Integer::toString( array.size() ), array.size() == SIZE );
+
+    array.set( 0, 1 );
+    CPPUNIT_ASSERT_MESSAGE( "Failed to set object", array.get( 0 ) == 1 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        array.set( -1, 10 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        array.set( array.size(), 10 ),
+        IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testSize() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect size for exiting list", SIZE, array.size() );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect size for new list", 0, ArrayList<int>().size());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testToString() {
+
+    ArrayList<int> l(1);
+    l.add( 5 );
+    std::string result = l.toString();
+    CPPUNIT_ASSERT_MESSAGE( "should produce a non-empty string", !result.empty() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testToArray() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+
+    array.set( 25, 0 );
+    array.set( 75, 0 );
+
+    std::vector<int> stlvec = array.toArray();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Returned array of incorrect size", SIZE, (int)stlvec.size() );
+
+    for( int i = 0; i < (int)stlvec.size(); i++ ) {
+        if( ( i == 25 ) || ( i == 75 ) ) {
+            CPPUNIT_ASSERT_EQUAL_MESSAGE( "Should be zero but instead got: ", 0, stlvec[i] );
+        } else {
+            CPPUNIT_ASSERT_EQUAL_MESSAGE( "Returned incorrect array: ", array.get(i), stlvec[i] );
+        }
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testTrimToSize() {
+
+    ArrayList<int> array;
+    populate( array, SIZE );
+    std::vector<int> mirror;
+    populate( mirror, SIZE );
+
+    for( int i = SIZE - 1; i > 24; i-- ) {
+        array.removeAt( i );
+    }
+
+    array.trimToSize();
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Returned incorrect size after trim", 25, array.size() );
+    for( int i = 0; i < array.size(); i++ ) {
+        CPPUNIT_ASSERT_MESSAGE( "Trimmed list contained incorrect elements", array.get(i) == mirror[i] );
+    }
+
+    StlList<std::string> list;
+    list.add( "a" );
+
+    ArrayList<std::string> strArray( list );
+    std::auto_ptr< Iterator<int> > iter( array.iterator() );
+    array.trimToSize();
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an ConcurrentModificationException",
+        iter->next(),
+        ConcurrentModificationException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testOverrideSize() {
+
+    MockArrayList<std::string> testlist;
+
+    // though size is overriden, it should passed without exception
+    testlist.add( "test_0" );
+    testlist.add( "test_1" );
+    testlist.add( "test_2" );
+    testlist.add( 1, "test_3" );
+    testlist.get( 1 );
+    testlist.removeAt( 2 );
+    testlist.set( 1, "test_4" );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testRemoveAll() {
+
+    ArrayList<int> list;
+    populate( list, 3 );
+
+    StlList<int> collection;
+    collection.add( 1 );
+    collection.add( 2 );
+
+    list.removeAll( collection );
+
+    CPPUNIT_ASSERT_EQUAL( 1, list.size() );
+
+    ArrayList<int> list2;
+    list2.removeAll( collection );
+    CPPUNIT_ASSERT_EQUAL( 0, list2.size() );
+
+    ArrayList<int> list3;
+    populate( list3, 3 );
+    collection.clear();
+
+    list3.removeAll( collection );
+    CPPUNIT_ASSERT_EQUAL( 3, list3.size() );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testRetainAll() {
+
+    ArrayList<int> list;
+    populate( list, 3 );
+
+    StlList<int> collection;
+    collection.add( 1 );
+    collection.add( 2 );
+
+    list.retainAll( collection );
+
+    CPPUNIT_ASSERT_EQUAL( 2, list.size() );
+
+    ArrayList<int> list2;
+    list2.retainAll( collection );
+    CPPUNIT_ASSERT_EQUAL( 0, list2.size() );
+
+    ArrayList<int> list3;
+    populate( list3, 3 );
+    collection.clear();
+
+    list3.retainAll( collection );
+    CPPUNIT_ASSERT_EQUAL( 0, list3.size() );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testListIterator1IndexOutOfBoundsException() {
+
+    ArrayList<int> list;
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        std::auto_ptr< ListIterator<int> > it( list.listIterator( -1 ) ),
+        IndexOutOfBoundsException );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void ArrayListTest::testListIterator2IndexOutOfBoundsException() {
+
+    ArrayList<int> list;
+    list.add( 1 );
+    list.add( 2 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        std::auto_ptr< ListIterator<int> > it( list.listIterator( 100 ) ),
+        IndexOutOfBoundsException );
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArrayListTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArrayListTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArrayListTest.h?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArrayListTest.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArrayListTest.h Thu Dec 16 23:18:02 2010
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_UTIL_ARRAYLISTTEST_H_
+#define _DECAF_UTIL_ARRAYLISTTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf {
+namespace util {
+
+    class ArrayListTest : public CppUnit::TestFixture {
+
+        CPPUNIT_TEST_SUITE( ArrayListTest );
+        CPPUNIT_TEST( testConstructor1 );
+        CPPUNIT_TEST( testConstructor2 );
+        CPPUNIT_TEST( testConstructor3 );
+        CPPUNIT_TEST( testAdd1 );
+        CPPUNIT_TEST( testAdd2 );
+        CPPUNIT_TEST( testAdd3 );
+        CPPUNIT_TEST( testAddAll1 );
+        CPPUNIT_TEST( testAddAll2 );
+        CPPUNIT_TEST( testAddAll3 );
+        CPPUNIT_TEST( testAddAll4 );
+        CPPUNIT_TEST( testAddAll5 );
+        CPPUNIT_TEST( testAddAll6 );
+        CPPUNIT_TEST( testAddAll7 );
+        CPPUNIT_TEST( testAddAll8 );
+        CPPUNIT_TEST( testAddAll9 );
+        CPPUNIT_TEST( testClear );
+        CPPUNIT_TEST( testContains );
+        CPPUNIT_TEST( testEnsureCapacity );
+        CPPUNIT_TEST( testGet );
+        CPPUNIT_TEST( testSet );
+        CPPUNIT_TEST( testIndexOf );
+        CPPUNIT_TEST( testIsEmpty );
+        CPPUNIT_TEST( testLastIndexOf );
+        CPPUNIT_TEST( testRemove );
+        CPPUNIT_TEST( testRemoveAt );
+        CPPUNIT_TEST( testSize );
+        CPPUNIT_TEST( testToString );
+        CPPUNIT_TEST( testToArray );
+        CPPUNIT_TEST( testTrimToSize );
+        CPPUNIT_TEST( testOverrideSize );
+        CPPUNIT_TEST( testRemoveAll );
+        CPPUNIT_TEST( testRetainAll );
+        CPPUNIT_TEST( testListIterator1IndexOutOfBoundsException );
+        CPPUNIT_TEST( testListIterator2IndexOutOfBoundsException );
+        CPPUNIT_TEST_SUITE_END();
+
+    private:
+
+        static const int SIZE;
+
+    public:
+
+        ArrayListTest();
+        virtual ~ArrayListTest();
+
+        void testConstructor1();
+        void testConstructor2();
+        void testConstructor3();
+        void testAdd1();
+        void testAdd2();
+        void testAdd3();
+        void testAddAll1();
+        void testAddAll2();
+        void testAddAll3();
+        void testAddAll4();
+        void testAddAll5();
+        void testAddAll6();
+        void testAddAll7();
+        void testAddAll8();
+        void testAddAll9();
+        void testClear();
+        void testContains();
+        void testEnsureCapacity();
+        void testGet();
+        void testSet();
+        void testIndexOf();
+        void testIsEmpty();
+        void testLastIndexOf();
+        void testRemove();
+        void testRemoveAt();
+        void testSize();
+        void testToString();
+        void testToArray();
+        void testTrimToSize();
+        void testOverrideSize();
+        void testRemoveAll();
+        void testRetainAll();
+        void testListIterator1IndexOutOfBoundsException();
+        void testListIterator2IndexOutOfBoundsException();
+
+    };
+
+}}
+
+#endif /* _DECAF_UTIL_ARRAYLISTTEST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArrayListTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArraysTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArraysTest.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArraysTest.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArraysTest.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ArraysTest.h"
+
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#include <decaf/util/Arrays.h>
+#include <decaf/lang/Integer.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+const int ArraysTest::SIZE = 256;
+
+////////////////////////////////////////////////////////////////////////////////
+ArraysTest::ArraysTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ArraysTest::~ArraysTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArraysTest::testFill1() {
+
+    bool boolArray[SIZE];
+    Arrays::fill( boolArray, SIZE, true );
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT_EQUAL( true, boolArray[i] );
+    }
+    Arrays::fill( boolArray, SIZE, false );
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT_EQUAL( false, boolArray[i] );
+    }
+
+    std::string stringArray[SIZE];
+    Arrays::fill( stringArray, SIZE, std::string("A") );
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT_EQUAL( std::string("A"), stringArray[i] );
+    }
+    Arrays::fill( stringArray, SIZE, std::string("B") );
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT_EQUAL( std::string("B"), stringArray[i] );
+    }
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw a NullPointerException",
+        Arrays::fill( (bool*)NULL, -1, false ),
+        NullPointerException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw a IllegalArgumentException",
+        Arrays::fill( boolArray, -1, false ),
+        IllegalArgumentException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ArraysTest::testFill2() {
+
+    bool boolArray[SIZE];
+    Arrays::fill( boolArray, SIZE, 0, SIZE, true );
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT_EQUAL( true, boolArray[i] );
+    }
+    Arrays::fill( boolArray, SIZE, 0, SIZE, false );
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT_EQUAL( false, boolArray[i] );
+    }
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw a NullPointerException",
+        Arrays::fill( (bool*)NULL, -1, 0, 1, false ),
+        NullPointerException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw a IllegalArgumentException",
+        Arrays::fill( boolArray, -1, 0, 1, false ),
+        IllegalArgumentException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw a IllegalArgumentException",
+        Arrays::fill( boolArray, SIZE, SIZE + 1, SIZE, false ),
+        IllegalArgumentException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw a IndexOutOfBoundsException",
+        Arrays::fill( boolArray, SIZE, -1, SIZE, false ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw a IndexOutOfBoundsException",
+        Arrays::fill( boolArray, SIZE, 0, SIZE + 10, false ),
+        IndexOutOfBoundsException );
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArraysTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArraysTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArraysTest.h?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArraysTest.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArraysTest.h Thu Dec 16 23:18:02 2010
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_UTIL_ARRAYSTEST_H_
+#define _DECAF_UTIL_ARRAYSTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf {
+namespace util {
+
+    class ArraysTest : public CppUnit::TestFixture {
+    private:
+
+        CPPUNIT_TEST_SUITE( ArraysTest );
+        CPPUNIT_TEST( testFill1 );
+        CPPUNIT_TEST( testFill2 );
+        CPPUNIT_TEST_SUITE_END();
+
+    private:
+
+        static const int SIZE;
+
+    public:
+
+        ArraysTest();
+        virtual ~ArraysTest();
+
+        void testFill1();
+        void testFill2();
+
+    };
+
+}}
+
+#endif /* _DECAF_UTIL_ARRAYSTEST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/ArraysTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/LinkedListTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/LinkedListTest.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/LinkedListTest.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/LinkedListTest.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,1255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "LinkedListTest.h"
+
+#include <decaf/util/ArrayList.h>
+#include <decaf/util/LinkedList.h>
+#include <decaf/lang/Integer.h>
+
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+using namespace decaf::util;
+
+////////////////////////////////////////////////////////////////////////////////
+const int LinkedListTest::SIZE = 256;
+
+////////////////////////////////////////////////////////////////////////////////
+namespace {
+
+    void populate( LinkedList<int>& list, int n ) {
+
+        CPPUNIT_ASSERT( list.isEmpty() );
+
+        for( int i = 0; i < n; ++i ) {
+            list.add( i );
+        }
+
+        CPPUNIT_ASSERT( !list.isEmpty());
+        CPPUNIT_ASSERT_EQUAL( n, list.size() );
+    }
+
+    void populate( LinkedList<std::string>& list, int n ) {
+
+        CPPUNIT_ASSERT( list.isEmpty() );
+
+        for( int i = 0; i < n; ++i ) {
+            list.add( Integer::toString( i ) );
+        }
+
+        CPPUNIT_ASSERT( !list.isEmpty());
+        CPPUNIT_ASSERT_EQUAL( n, list.size() );
+    }
+
+    void populate( std::vector<int>& list, int n ) {
+
+        CPPUNIT_ASSERT( list.empty() );
+
+        for( int i = 0; i < n; ++i ) {
+            list.push_back( i );
+        }
+
+        CPPUNIT_ASSERT( !list.empty());
+        CPPUNIT_ASSERT_EQUAL( n, (int)list.size() );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+LinkedListTest::LinkedListTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+LinkedListTest::~LinkedListTest() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testConstructor1() {
+
+    LinkedList<int> list;
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+    CPPUNIT_ASSERT( list.isEmpty() == true );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testConstructor2() {
+
+    LinkedList<int> mylist;
+    populate( mylist, SIZE );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testConstructor3() {
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testEquals() {
+
+    LinkedList<int> list1;
+    populate( list1, 7 );
+    LinkedList<int> list2;
+    populate( list2, 7 );
+
+    CPPUNIT_ASSERT( list1.equals( list2 ) );
+    CPPUNIT_ASSERT( list2.equals( list1 ) );
+
+    list1.add( 42 );
+    CPPUNIT_ASSERT( !list1.equals( list2 ) );
+    CPPUNIT_ASSERT( !list2.equals( list1 ) );
+    list2.add( 42 );
+    CPPUNIT_ASSERT( list1.equals( list2 ) );
+    CPPUNIT_ASSERT( list2.equals( list1 ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testGet() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    CPPUNIT_ASSERT_EQUAL( 0, list.get(0) );
+    CPPUNIT_ASSERT_EQUAL( SIZE/2, list.get(SIZE/2) );
+    CPPUNIT_ASSERT_EQUAL( SIZE-1, list.get(SIZE-1) );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IndexOutOfBoundsException",
+        list.get(-1),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IndexOutOfBoundsException",
+        list.get(SIZE),
+        IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testSet() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    CPPUNIT_ASSERT_EQUAL( 0, list.get(0) );
+    CPPUNIT_ASSERT_EQUAL( 0, list.set(0, 42) );
+    CPPUNIT_ASSERT_EQUAL( 42, list.get(0) );
+    CPPUNIT_ASSERT_EQUAL( SIZE/2, list.get(SIZE/2) );
+    CPPUNIT_ASSERT_EQUAL( SIZE/2, list.set(SIZE/2, 42) );
+    CPPUNIT_ASSERT_EQUAL( 42, list.get(SIZE/2) );
+    CPPUNIT_ASSERT_EQUAL( SIZE-1, list.get(SIZE-1) );
+    CPPUNIT_ASSERT_EQUAL( SIZE-1, list.set(SIZE-1, 42) );
+    CPPUNIT_ASSERT_EQUAL( 42, list.get(SIZE-1) );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IndexOutOfBoundsException",
+        list.set(-1, 42),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IndexOutOfBoundsException",
+        list.set(SIZE, 42),
+        IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testOffer() {
+
+    LinkedList<int> list;
+    CPPUNIT_ASSERT_EQUAL( true, list.offer( 42 ) );
+    CPPUNIT_ASSERT( list.size() == 1 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+    CPPUNIT_ASSERT_EQUAL( true, list.offer( 84 ) );
+    CPPUNIT_ASSERT( list.size() == 2 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+    CPPUNIT_ASSERT_EQUAL( 84, list.getLast() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testAddFirst() {
+
+    LinkedList<int> list;
+    list.addFirst( 42 );
+    CPPUNIT_ASSERT( list.size() == 1 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+    list.addFirst( 84 );
+    CPPUNIT_ASSERT( list.size() == 2 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 84, list.getFirst() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testAddLast() {
+
+    LinkedList<int> list;
+    list.addLast( 42 );
+    CPPUNIT_ASSERT( list.size() == 1 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+    list.addLast( 84 );
+    CPPUNIT_ASSERT( list.size() == 2 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+    CPPUNIT_ASSERT_EQUAL( 84, list.getLast() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testGetFirst() {
+
+    LinkedList<int> list;
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an NoSuchElementException",
+        list.getFirst(),
+        NoSuchElementException );
+
+    populate( list, SIZE );
+    CPPUNIT_ASSERT_EQUAL( 0, list.getFirst() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testGetLast() {
+
+    LinkedList<int> list;
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an NoSuchElementException",
+        list.getLast(),
+        NoSuchElementException );
+
+    populate( list, SIZE );
+    CPPUNIT_ASSERT_EQUAL( SIZE-1, list.getLast() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testAdd1() {
+
+    LinkedList<int> list;
+
+    list.add( 42 );
+
+    CPPUNIT_ASSERT( list.size() == 1 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+
+    list.add( 49 );
+    list.add( 50 );
+    list.add( 51 );
+    list.add( 60 );
+    list.add( 84 );
+
+    CPPUNIT_ASSERT( list.indexOf( 42 ) == 0 );
+    CPPUNIT_ASSERT( list.size() == 6 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 84, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+
+    LinkedList<int> mylist;
+    populate( mylist, SIZE );
+    CPPUNIT_ASSERT_EQUAL( 0, mylist.get( 0 ) );
+    CPPUNIT_ASSERT_EQUAL( SIZE-1, mylist.get( SIZE-1 ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testAdd2() {
+
+    LinkedList<int> list;
+
+    list.add( 0, 42 );
+
+    CPPUNIT_ASSERT( list.size() == 1 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+
+    list.add( 1, 84 );
+
+    CPPUNIT_ASSERT( list.size() == 2 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 84, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+
+    list.add( 0, 21 );
+
+    CPPUNIT_ASSERT( list.size() == 3 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 84, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 21, list.getFirst() );
+
+    list.add( 1, 22 );
+    list.add( 4, 168 );
+
+    CPPUNIT_ASSERT( list.size() == 5 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 168, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 21, list.getFirst() );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IndexOutOfBoundsException",
+        list.add( -1, 12 ),
+        IndexOutOfBoundsException );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IndexOutOfBoundsException",
+        list.add( 100, 12 ),
+        IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testAddAll1() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+    ArrayList<int> listCopy( list );
+
+    list.addAll( 50, listCopy );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Returned incorrect size after adding to existing list",
+                                  SIZE * 2, list.size() );
+    for( int i = 0; i < 50; i++ ) {
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( "Manipulated elements < index", i, list.get( i ) );
+    }
+    for( int i = 50; i < SIZE + 50; i++ ) {
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( "Failed to add elements properly", i - 50, list.get( i ) );
+    }
+    for( int i = SIZE+50; i < SIZE * 2; i++ ) {
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( "Failed to add elements properly", i - SIZE, list.get( i ) );
+    }
+
+    LinkedList<int> list2;
+
+    list2.add(4);
+    list2.add(3);
+    list2.add(2);
+    list2.add(1);
+    list2.add(0);
+
+    list.addAll( 50, list2 );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "smaller list not added correctly", 4, list.get(50) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "smaller list not added correctly", 3, list.get(51) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "smaller list not added correctly", 2, list.get(52) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "smaller list not added correctly", 1, list.get(53) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "smaller list not added correctly", 0, list.get(54) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testAddAll2() {
+
+    LinkedList<int> list;
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IndexOutOfBoundsException",
+        list.addAll( -1, ArrayList<int>() ),
+        IndexOutOfBoundsException );
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IndexOutOfBoundsException",
+        list.addAll( 99, ArrayList<int>() ),
+        IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testAddAll3() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+    ArrayList<int> listCopy( list );
+
+    list.addAll( listCopy );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Returned incorrect size after adding to existing list",
+                                  SIZE * 2, list.size() );
+    for( int i = 0; i < SIZE; i++ ) {
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( "Failed to add elements properly", i, list.get( i ) );
+    }
+    for( int i = SIZE; i < SIZE * 2; i++ ) {
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( "Failed to add elements properly", i - SIZE, list.get( i ) );
+    }
+
+    int newSize = list.size();
+
+    LinkedList<int> list2;
+
+    list2.add(4);
+    list2.add(3);
+    list2.add(2);
+    list2.add(1);
+    list2.add(0);
+
+    list.addAll( list2 );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "smaller list not added correctly", 4, list.get(newSize) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "smaller list not added correctly", 3, list.get(newSize+1) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "smaller list not added correctly", 2, list.get(newSize+2) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "smaller list not added correctly", 1, list.get(newSize+3) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "smaller list not added correctly", 0, list.get(newSize+4) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testAddAll4() {
+
+    ArrayList<int> emptyCollection;
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        ArrayList<int>().addAll( -1, emptyCollection ),
+        IndexOutOfBoundsException );
+
+    {
+        std::string data[] = { "1", "2", "3", "4", "5", "6", "7", "8" };
+        LinkedList<std::string> list1;
+        LinkedList<std::string> list2;
+        for( int i = 0; i < 8; ++i ) {
+            list1.add( data[i] );
+            list2.add( data[i] );
+            list2.add( data[i] );
+        }
+
+        while( list1.size() > 0 ) {
+            list1.removeAt( 0 );
+        }
+        list1.addAll( list2 );
+        CPPUNIT_ASSERT_MESSAGE( "The object list is not the same as original list",
+                                list1.containsAll( list2 ) && list2.containsAll( list1 ) );
+
+        LinkedList<std::string> list3;
+        for( int i = 0; i < 100; i++ ) {
+            if( list1.size() > 0 ) {
+                list3.removeAll( list1 );
+                list3.addAll( list1 );
+            }
+        }
+        CPPUNIT_ASSERT_MESSAGE( "The object list is not the same as original list",
+                                list3.containsAll( list1 ) && list1.containsAll( list3 ) );
+    }
+    {
+        LinkedList<std::string> list1;
+        LinkedList<std::string> list2;
+        int location = 2;
+
+        std::string data1[] = { "1", "2", "3", "4", "5", "6" };
+        std::string data2[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+        for( int i = 0; i < 6; i++ ) {
+            list1.add( data1[i] );
+        }
+        for( int i = 0; i < 8; i++ ) {
+            list2.add( data2[i] );
+        }
+
+        list1.removeAt( location );
+        list1.addAll( location, list2 );
+
+        // Inserted elements should be equal to second array
+        for( int i = 0; i < 8; i++ ) {
+            CPPUNIT_ASSERT_EQUAL( data2[i], list1.get( location + i ) );
+        }
+        // Elements after inserted location should
+        // be equals to related elements in first array
+        for( int i = location + 1; i < 6; i++ ) {
+            CPPUNIT_ASSERT_EQUAL( data1[i], list1.get( i + 8 - 1 ) );
+        }
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testAddAllSelfAsCollection1() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    CPPUNIT_ASSERT_EQUAL( SIZE, list.size() );
+    CPPUNIT_ASSERT_EQUAL( true, list.addAll( list ) );
+    CPPUNIT_ASSERT_EQUAL( SIZE+SIZE, list.size() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testAddAllSelfAsCollection2() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    CPPUNIT_ASSERT_EQUAL( SIZE, list.size() );
+    CPPUNIT_ASSERT_EQUAL( true, list.addAll( 1, list ) );
+    CPPUNIT_ASSERT_EQUAL( SIZE+SIZE, list.size() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testRemoveAtIndex() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+    list.removeAt(10);
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Failed to remove element", -1, list.indexOf(10) );
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an IndexOutOfBoundsException",
+        list.removeAt( 999 ),
+        IndexOutOfBoundsException );
+
+    list.add( 20, 0 );
+    list.removeAt(20);
+    CPPUNIT_ASSERT_MESSAGE( "Should not have removed 0", list.get(20) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testRemoveByValue() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    CPPUNIT_ASSERT_MESSAGE( "Failed to remove valid Object", list.remove(42) );
+    CPPUNIT_ASSERT_MESSAGE( "Removed invalid object", !list.remove(999) );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Found Object after removal", -1, list.indexOf(42) );
+    list.add(SIZE+1);
+    list.remove(SIZE+1);
+    CPPUNIT_ASSERT_MESSAGE( "Should not contain null afrer removal", !list.contains(SIZE+1) );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testRemoveAll() {
+
+    LinkedList<int> list;
+    populate( list, 3 );
+
+    ArrayList<int> collection;
+    collection.add( 1 );
+    collection.add( 2 );
+
+    list.removeAll( collection );
+
+    CPPUNIT_ASSERT_EQUAL( 1, list.size() );
+
+    LinkedList<int> list2;
+    list2.removeAll( collection );
+    CPPUNIT_ASSERT_EQUAL( 0, list2.size() );
+
+    LinkedList<int> list3;
+    populate( list3, 3 );
+    collection.clear();
+
+    list3.removeAll( collection );
+    CPPUNIT_ASSERT_EQUAL( 3, list3.size() );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testRetainAll() {
+
+    LinkedList<int> list;
+    populate( list, 3 );
+
+    ArrayList<int> collection;
+    collection.add( 1 );
+    collection.add( 2 );
+
+    list.retainAll( collection );
+
+    CPPUNIT_ASSERT_EQUAL( 2, list.size() );
+
+    LinkedList<int> list2;
+    list2.retainAll( collection );
+    CPPUNIT_ASSERT_EQUAL( 0, list2.size() );
+
+    LinkedList<int> list3;
+    populate( list3, 3 );
+    collection.clear();
+
+    list3.retainAll( collection );
+    CPPUNIT_ASSERT_EQUAL( 0, list3.size() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testClear() {
+
+    LinkedList<int> list;
+
+    list.clear();
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+    CPPUNIT_ASSERT( list.isEmpty() == true );
+
+    list.add( 42 );
+    list.add( 42 );
+    list.add( 1 );
+
+    CPPUNIT_ASSERT( list.size() == 3 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+
+    list.clear();
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+    CPPUNIT_ASSERT( list.isEmpty() == true );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testIndexOf() {
+
+    LinkedList<int> list;
+
+    CPPUNIT_ASSERT_EQUAL( -1, list.indexOf(42) );
+
+    list.add( 21 );
+
+    CPPUNIT_ASSERT_EQUAL( 0, list.indexOf(21) );
+
+    list.add( 42 );
+    list.add( 84 );
+    list.add( 168 );
+
+    CPPUNIT_ASSERT_EQUAL( 168, list.getLast() );
+
+    CPPUNIT_ASSERT_EQUAL( 1, list.indexOf(42) );
+    CPPUNIT_ASSERT_EQUAL( 0, list.indexOf(21) );
+    CPPUNIT_ASSERT_EQUAL( 2, list.indexOf(84) );
+    CPPUNIT_ASSERT_EQUAL( 3, list.indexOf(168) );
+    CPPUNIT_ASSERT_EQUAL( -1, list.indexOf(336) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testLastIndexOf() {
+
+    LinkedList<int> list;
+
+    CPPUNIT_ASSERT_EQUAL( -1, list.lastIndexOf(42) );
+
+    list.add( 21 );
+
+    CPPUNIT_ASSERT_EQUAL( 0, list.lastIndexOf(21) );
+
+    list.add( 42 );
+    list.add( 84 );
+    list.add( 168 );
+
+    CPPUNIT_ASSERT_EQUAL( 168, list.getLast() );
+
+    CPPUNIT_ASSERT_EQUAL( 1, list.lastIndexOf(42) );
+    CPPUNIT_ASSERT_EQUAL( 0, list.lastIndexOf(21) );
+    CPPUNIT_ASSERT_EQUAL( 2, list.lastIndexOf(84) );
+    CPPUNIT_ASSERT_EQUAL( 3, list.lastIndexOf(168) );
+    CPPUNIT_ASSERT_EQUAL( -1, list.lastIndexOf(336) );
+
+    list.add( 42 );
+    CPPUNIT_ASSERT_EQUAL( list.size() - 1, list.lastIndexOf(42) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testContains() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    CPPUNIT_ASSERT( list.contains( 42 ) );
+    CPPUNIT_ASSERT( list.contains( 0 ) );
+    CPPUNIT_ASSERT( !list.contains( -1 ) );
+    CPPUNIT_ASSERT( !list.contains( SIZE ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testContainsAll() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    LinkedList<int> list2;
+    populate( list2, SIZE*2 );
+
+    CPPUNIT_ASSERT( list2.containsAll( list ) );
+    CPPUNIT_ASSERT( !list.containsAll( list2 ) );
+    CPPUNIT_ASSERT( list2.containsAll( list2 ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testToArray() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    std::vector<int> array = list.toArray();
+    CPPUNIT_ASSERT_EQUAL( SIZE, (int)array.size() );
+    CPPUNIT_ASSERT_EQUAL( 0, array[0] );
+    CPPUNIT_ASSERT_EQUAL( SIZE/2, array[SIZE/2] );
+    CPPUNIT_ASSERT_EQUAL( SIZE-1, array[SIZE-1] );
+
+    list.clear();
+    array = list.toArray();
+    CPPUNIT_ASSERT( array.empty() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testPoll() {
+
+    int result = 0;
+    LinkedList<int> list;
+    CPPUNIT_ASSERT( list.poll( result ) == false );
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.poll( result ) == true );
+        CPPUNIT_ASSERT_EQUAL( i, result );
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+    CPPUNIT_ASSERT( list.poll( result ) == false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testQRemove() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.remove() == i );
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an NoSuchElementException",
+        list.remove(),
+        NoSuchElementException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testPeek() {
+
+    int result = 0;
+    LinkedList<int> list;
+    CPPUNIT_ASSERT( list.peek( result ) == false );
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.peek( result ) == true );
+        CPPUNIT_ASSERT_EQUAL( i, result );
+        list.remove();
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+    CPPUNIT_ASSERT( list.peek( result ) == false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testElement() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.element() == i );
+        list.remove();
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an NoSuchElementException",
+        list.element(),
+        NoSuchElementException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testOfferFirst() {
+
+    LinkedList<int> list;
+    CPPUNIT_ASSERT_EQUAL( true, list.offerFirst( 42 ) );
+    CPPUNIT_ASSERT( list.size() == 1 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+    CPPUNIT_ASSERT_EQUAL( true, list.offerFirst( 84 ) );
+    CPPUNIT_ASSERT( list.size() == 2 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 84, list.getFirst() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testOfferLast() {
+
+    LinkedList<int> list;
+    CPPUNIT_ASSERT_EQUAL( true, list.offerLast( 42 ) );
+    CPPUNIT_ASSERT( list.size() == 1 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+    CPPUNIT_ASSERT_EQUAL( true, list.offerLast( 84 ) );
+    CPPUNIT_ASSERT( list.size() == 2 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+    CPPUNIT_ASSERT_EQUAL( 84, list.getLast() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testRemoveFirst() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.removeFirst() == i );
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an NoSuchElementException",
+        list.removeFirst(),
+        NoSuchElementException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testRemoveLast() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.removeLast() == SIZE - i - 1 );
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an NoSuchElementException",
+        list.removeLast(),
+        NoSuchElementException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testPollFirst() {
+
+    int result = 0;
+    LinkedList<int> list;
+    CPPUNIT_ASSERT( list.pollFirst( result ) == false );
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.pollFirst( result ) == true );
+        CPPUNIT_ASSERT_EQUAL( i, result );
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+    CPPUNIT_ASSERT( list.pollFirst( result ) == false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testPollLast() {
+
+    int result = 0;
+    LinkedList<int> list;
+    CPPUNIT_ASSERT( list.pollLast( result ) == false );
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.pollLast( result ) == true );
+        CPPUNIT_ASSERT_EQUAL( SIZE - i - 1, result );
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+    CPPUNIT_ASSERT( list.pollLast( result ) == false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testPeekFirst() {
+
+    int result = 0;
+    LinkedList<int> list;
+    CPPUNIT_ASSERT( list.peekFirst( result ) == false );
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.peekFirst( result ) == true );
+        CPPUNIT_ASSERT_EQUAL( i, result );
+        list.removeFirst();
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+    CPPUNIT_ASSERT( list.peekFirst( result ) == false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testPeekLast() {
+
+    int result = 0;
+    LinkedList<int> list;
+    CPPUNIT_ASSERT( list.peekLast( result ) == false );
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.peekLast( result ) == true );
+        CPPUNIT_ASSERT_EQUAL( SIZE - i - 1, result );
+        list.removeLast();
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+    CPPUNIT_ASSERT( list.peekLast( result ) == false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testPop() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    for( int i = 0; i < SIZE; ++i ) {
+        CPPUNIT_ASSERT( list.pop() == i );
+    }
+
+    CPPUNIT_ASSERT( list.size() == 0 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown an NoSuchElementException",
+        list.pop(),
+        NoSuchElementException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testPush() {
+
+    LinkedList<int> list;
+    list.push( 42 );
+    CPPUNIT_ASSERT( list.size() == 1 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getFirst() );
+    list.push( 84 );
+    CPPUNIT_ASSERT( list.size() == 2 );
+    CPPUNIT_ASSERT( list.isEmpty() == false );
+    CPPUNIT_ASSERT_EQUAL( 84, list.getFirst() );
+    CPPUNIT_ASSERT_EQUAL( 42, list.getLast() );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testListIterator1IndexOutOfBoundsException() {
+
+    LinkedList<std::string> list;
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        std::auto_ptr< ListIterator<std::string> > it( list.listIterator( -1 ) ),
+        IndexOutOfBoundsException );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testListIterator2IndexOutOfBoundsException() {
+
+    LinkedList<std::string> list;
+    list.add( "1" );
+    list.add( "2" );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should throw an IndexOutOfBoundsException",
+        std::auto_ptr< ListIterator<std::string> > it( list.listIterator( 100 ) ),
+        IndexOutOfBoundsException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testIterator1() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    std::auto_ptr< Iterator<int> > iter( list.iterator() );
+
+    CPPUNIT_ASSERT( iter->hasNext() );
+
+    int count = 0;
+    while( iter->hasNext() ) {
+        CPPUNIT_ASSERT_EQUAL( count++, iter->next() );
+    }
+
+    CPPUNIT_ASSERT_EQUAL( SIZE, count );
+
+    CPPUNIT_ASSERT( !iter->hasNext() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testIterator2() {
+
+    LinkedList<std::string> list;
+
+    list.add( "fred1" );
+    list.add( "fred2" );
+    list.add( "fred3" );
+
+    std::auto_ptr< Iterator<std::string> > iterator1( list.iterator() );
+    CPPUNIT_ASSERT( iterator1.get() != NULL );
+    CPPUNIT_ASSERT( iterator1->hasNext() == true );
+
+    int count = 0;
+    while( iterator1->hasNext() ) {
+        iterator1->next();
+        ++count;
+    }
+
+    CPPUNIT_ASSERT( count == list.size() );
+
+    std::auto_ptr< Iterator<std::string> > iterator2( list.iterator() );
+
+    while( iterator2->hasNext() ) {
+        iterator2->next();
+        iterator2->remove();
+    }
+
+    CPPUNIT_ASSERT( list.isEmpty() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testListIterator1() {
+
+    LinkedList<int> list;
+    populate( list, SIZE );
+
+    std::auto_ptr< ListIterator<int> > iter( list.listIterator() );
+
+    int index = 0;
+    while( iter->hasNext() ) {
+
+        if( index == 0 ) {
+            CPPUNIT_ASSERT_MESSAGE( "The first element cannot have a previous", !iter->hasPrevious() );
+        }
+        if( index == SIZE ) {
+            CPPUNIT_FAIL( std::string("List index should be capped at ") + Integer::toString(SIZE) );
+        }
+
+        int value = iter->next();
+        if( index + 1 == SIZE ) {
+            CPPUNIT_ASSERT_MESSAGE( "The last element cannot have a next", !iter->hasNext() );
+        }
+
+        CPPUNIT_ASSERT_EQUAL( index, value );
+
+        if( index > 0 && index < (SIZE - 1) ) {
+            CPPUNIT_ASSERT_MESSAGE( "Next index returned incorrect value",
+                                    iter->nextIndex() == index + 1 );
+            CPPUNIT_ASSERT_EQUAL_MESSAGE( "previousIndex returned incorrect value :",
+                                          iter->previousIndex(), index );
+        }
+
+        index++;
+    }
+
+    LinkedList<int> myList;
+    populate( myList, 5 );
+    iter.reset( myList.listIterator() );
+
+    CPPUNIT_ASSERT_MESSAGE( "hasPrevious() should be false", !iter->hasPrevious() );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "next() should be 0", 0, iter->next() );
+    CPPUNIT_ASSERT_MESSAGE( "hasPrevious() should be true", iter->hasPrevious() );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "prev() should be 0", 0, iter->previous() );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "next() should be 0", 0, iter->next() );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "next() should be 1", 1, iter->next() );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "next() should be 2", 2, iter->next() );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "next() should be 3", 3, iter->next() );
+    CPPUNIT_ASSERT_MESSAGE( "hasNext() should be true", iter->hasNext() );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "next() should be 4", 4, iter->next() );
+    CPPUNIT_ASSERT_MESSAGE( "hasNext() should be false", !iter->hasNext() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testListIterator2() {
+
+    LinkedList<int> list;
+    list.add(1);
+    list.add(2);
+
+    std::auto_ptr< ListIterator<int> > iter( list.listIterator() );
+
+    while( iter->hasNext() ) {
+        iter->next();
+    }
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a NoSuchElementException",
+        iter->next(),
+        NoSuchElementException );
+    CPPUNIT_ASSERT_EQUAL( list.size(), iter->nextIndex() );
+
+    list.add(3);
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a ConcurrentModificationException",
+        iter->next(),
+        ConcurrentModificationException );
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a ConcurrentModificationException",
+        iter->add(42),
+        ConcurrentModificationException );
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a ConcurrentModificationException",
+        iter->remove(),
+        ConcurrentModificationException );
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a ConcurrentModificationException",
+        iter->previous(),
+        ConcurrentModificationException );
+
+    iter.reset( list.listIterator() );
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a IllegalStateException",
+        iter->previous(),
+        IllegalStateException );
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a IllegalStateException",
+        iter->set( 42 ),
+        IllegalStateException );
+
+    int value = iter->next();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Should have returned first element", 1, value );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testListIterator3() {
+
+    LinkedList<int> list;
+    std::auto_ptr< ListIterator<int> > iter( list.listIterator() );
+    CPPUNIT_ASSERT_EQUAL( -1, iter->previousIndex() );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a NoSuchElementException",
+        iter->next(),
+        NoSuchElementException );
+
+    CPPUNIT_ASSERT_MESSAGE( "hasNext() should be false", !iter->hasNext() );
+    iter->add(42);
+
+    CPPUNIT_ASSERT_MESSAGE( "hasPrevious() should be true", iter->hasPrevious() );
+    CPPUNIT_ASSERT_EQUAL( 42, iter->previous() );
+    CPPUNIT_ASSERT_MESSAGE( "hasNext() should be true", iter->hasNext() );
+    CPPUNIT_ASSERT_EQUAL( 42, iter->next() );
+    CPPUNIT_ASSERT_MESSAGE( "hasNext() should be false", !iter->hasNext() );
+    iter->set(84);
+    CPPUNIT_ASSERT_EQUAL( 84, iter->previous() );
+    iter->set(42);
+    CPPUNIT_ASSERT_EQUAL( 42, iter->next() );
+    CPPUNIT_ASSERT_EQUAL( 1, list.size() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testListIterator4() {
+
+    LinkedList<int> list;
+    std::auto_ptr< ListIterator<int> > iter( list.listIterator( 0 ) );
+    CPPUNIT_ASSERT_EQUAL( 0, iter->nextIndex() );
+    CPPUNIT_ASSERT_EQUAL( -1, iter->previousIndex() );
+
+    populate( list, 3 );
+    iter.reset( list.listIterator( 0 ) );
+    CPPUNIT_ASSERT_EQUAL( 0, iter->nextIndex() );
+    CPPUNIT_ASSERT_EQUAL( -1, iter->previousIndex() );
+
+    iter.reset( list.listIterator( 1 ) );
+    CPPUNIT_ASSERT_EQUAL( 1, iter->nextIndex() );
+    CPPUNIT_ASSERT_EQUAL( 0, iter->previousIndex() );
+
+    iter.reset( list.listIterator( 2 ) );
+    CPPUNIT_ASSERT_EQUAL( 2, iter->nextIndex() );
+    CPPUNIT_ASSERT_EQUAL( 1, iter->previousIndex() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testDescendingIterator() {
+
+    LinkedList<int> list;
+    std::auto_ptr< Iterator<int> > iter( list.descendingIterator() );
+
+    CPPUNIT_ASSERT( !iter->hasNext() );
+
+    populate( list, 5 );
+
+    iter.reset( list.descendingIterator() );
+    CPPUNIT_ASSERT_EQUAL( 5, list.size() );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a IllegalStateException",
+        iter->remove(),
+        IllegalStateException );
+
+    list.add( 5 );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a ConcurrentModificationException",
+        iter->remove(),
+        ConcurrentModificationException );
+
+    iter.reset( list.descendingIterator() );
+    CPPUNIT_ASSERT_EQUAL( 5, iter->next() );
+    CPPUNIT_ASSERT_EQUAL( 4, iter->next() );
+    CPPUNIT_ASSERT_EQUAL( 3, iter->next() );
+    CPPUNIT_ASSERT_EQUAL( 2, iter->next() );
+    CPPUNIT_ASSERT_EQUAL( 1, iter->next() );
+
+    CPPUNIT_ASSERT( iter->hasNext() );
+    iter->remove();
+    CPPUNIT_ASSERT_EQUAL( 0, iter->next() );
+    CPPUNIT_ASSERT( !iter->hasNext() );
+
+    CPPUNIT_ASSERT_THROW_MESSAGE(
+        "Should have thrown a NoSuchElementException",
+        iter->next(),
+        NoSuchElementException );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testRemoveFirstOccurrence() {
+
+    LinkedList<int> list;
+    std::auto_ptr< Iterator<int> > iter( list.descendingIterator() );
+
+    CPPUNIT_ASSERT( list.offerLast(1) );
+    CPPUNIT_ASSERT( list.offerLast(2) );
+    CPPUNIT_ASSERT( list.offerLast(1) );
+    CPPUNIT_ASSERT( list.offerLast(3) );
+    CPPUNIT_ASSERT( list.offerLast(1) );
+
+    CPPUNIT_ASSERT_EQUAL( 5, list.size() );
+
+    CPPUNIT_ASSERT( list.removeFirstOccurrence(1) );
+    CPPUNIT_ASSERT( !list.removeFirstOccurrence(4) );
+    CPPUNIT_ASSERT_EQUAL( 2, list.getFirst() );
+    CPPUNIT_ASSERT_EQUAL( 1, list.getLast() );
+    CPPUNIT_ASSERT_EQUAL( 4, list.size() );
+    CPPUNIT_ASSERT( list.removeFirstOccurrence(1) );
+    CPPUNIT_ASSERT_EQUAL( 3, list.size() );
+    CPPUNIT_ASSERT_EQUAL( 1, list.getLast() );
+    CPPUNIT_ASSERT( list.removeFirstOccurrence(1) );
+    CPPUNIT_ASSERT_EQUAL( 2, list.size() );
+    CPPUNIT_ASSERT_EQUAL( 3, list.getLast() );
+    CPPUNIT_ASSERT( !list.removeFirstOccurrence(1) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LinkedListTest::testRemoveLastOccurrence() {
+
+//    CPPUNIT_ASSERT(list.offerLast(testObjOne));
+//    CPPUNIT_ASSERT(list.offerLast(testObjTwo));
+//    CPPUNIT_ASSERT(list.offerLast(testObjOne));
+//    CPPUNIT_ASSERT(list.offerLast(testObjThree));
+//    CPPUNIT_ASSERT(list.offerLast(testObjOne));
+//    CPPUNIT_ASSERT_EQUAL(5, list.size());
+//    CPPUNIT_ASSERT(list.removeLastOccurrence(testObjOne));
+//    assertFalse(list.removeLastOccurrence(testObjFour));
+//    CPPUNIT_ASSERT_EQUAL(testObjOne, list.peekFirst());
+//    CPPUNIT_ASSERT_EQUAL(testObjThree, list.peekLast());
+//    CPPUNIT_ASSERT_EQUAL(4, list.size());
+//    CPPUNIT_ASSERT(list.removeLastOccurrence(testObjOne));
+//    CPPUNIT_ASSERT_EQUAL(3, list.size());
+//    CPPUNIT_ASSERT_EQUAL(testObjOne, list.peekFirst());
+//    CPPUNIT_ASSERT_EQUAL(testObjThree, list.peekLast());
+//    CPPUNIT_ASSERT(list.removeLastOccurrence(testObjOne));
+//    CPPUNIT_ASSERT_EQUAL(2, list.size());
+//    CPPUNIT_ASSERT_EQUAL(testObjThree, list.peekLast());
+//    assertFalse(list.removeLastOccurrence(testObjOne));
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/LinkedListTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/LinkedListTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/LinkedListTest.h?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/LinkedListTest.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/LinkedListTest.h Thu Dec 16 23:18:02 2010
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_UTIL_LINKEDLISTTEST_H_
+#define _DECAF_UTIL_LINKEDLISTTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf {
+namespace util {
+
+    class LinkedListTest : public CppUnit::TestFixture
+    {
+        CPPUNIT_TEST_SUITE( LinkedListTest );
+        CPPUNIT_TEST( testConstructor1 );
+        CPPUNIT_TEST( testConstructor2 );
+        CPPUNIT_TEST( testConstructor3 );
+        CPPUNIT_TEST( testEquals );
+        CPPUNIT_TEST( testGet );
+        CPPUNIT_TEST( testSet );
+        CPPUNIT_TEST( testAdd1 );
+        CPPUNIT_TEST( testAdd2 );
+        CPPUNIT_TEST( testAddAll1 );
+        CPPUNIT_TEST( testAddAll2 );
+        CPPUNIT_TEST( testAddAll3 );
+        CPPUNIT_TEST( testAddAll4 );
+        CPPUNIT_TEST( testAddAllSelfAsCollection1 );
+        CPPUNIT_TEST( testAddAllSelfAsCollection2 );
+        CPPUNIT_TEST( testAddFirst );
+        CPPUNIT_TEST( testAddLast );
+        CPPUNIT_TEST( testRemoveAtIndex );
+        CPPUNIT_TEST( testRemoveByValue );
+        CPPUNIT_TEST( testRemoveAll );
+        CPPUNIT_TEST( testRetainAll );
+        CPPUNIT_TEST( testGetFirst );
+        CPPUNIT_TEST( testGetLast );
+        CPPUNIT_TEST( testClear );
+        CPPUNIT_TEST( testIndexOf );
+        CPPUNIT_TEST( testLastIndexOf );
+        CPPUNIT_TEST( testContains );
+        CPPUNIT_TEST( testContainsAll );
+        CPPUNIT_TEST( testToArray );
+        CPPUNIT_TEST( testOffer );
+        CPPUNIT_TEST( testPoll );
+        CPPUNIT_TEST( testPeek );
+        CPPUNIT_TEST( testElement );
+        CPPUNIT_TEST( testQRemove );
+        CPPUNIT_TEST( testOfferFirst );
+        CPPUNIT_TEST( testOfferLast );
+        CPPUNIT_TEST( testRemoveFirst );
+        CPPUNIT_TEST( testRemoveLast );
+        CPPUNIT_TEST( testPollFirst );
+        CPPUNIT_TEST( testPollLast );
+        CPPUNIT_TEST( testPeekFirst );
+        CPPUNIT_TEST( testPeekLast );
+        CPPUNIT_TEST( testPop );
+        CPPUNIT_TEST( testPush );
+        CPPUNIT_TEST( testIterator1 );
+        CPPUNIT_TEST( testIterator2 );
+        CPPUNIT_TEST( testListIterator1 );
+        CPPUNIT_TEST( testListIterator2 );
+        CPPUNIT_TEST( testListIterator3 );
+        CPPUNIT_TEST( testListIterator4 );
+        CPPUNIT_TEST( testListIterator1IndexOutOfBoundsException );
+        CPPUNIT_TEST( testListIterator2IndexOutOfBoundsException );
+        CPPUNIT_TEST( testDescendingIterator );
+        CPPUNIT_TEST( testRemoveFirstOccurrence );
+        CPPUNIT_TEST( testRemoveLastOccurrence );
+        CPPUNIT_TEST_SUITE_END();
+
+    private:
+
+        static const int SIZE;
+
+    public:
+
+        LinkedListTest();
+        virtual ~LinkedListTest();
+
+        void testConstructor1();
+        void testConstructor2();
+        void testConstructor3();
+        void testEquals();
+        void testGet();
+        void testSet();
+        void testAdd1();
+        void testAdd2();
+        void testAddAll1();
+        void testAddAll2();
+        void testAddAll3();
+        void testAddAll4();
+        void testAddAllSelfAsCollection1();
+        void testAddAllSelfAsCollection2();
+        void testAddFirst();
+        void testAddLast();
+        void testRemoveAtIndex();
+        void testRemoveByValue();
+        void testRemoveAll();
+        void testRetainAll();
+        void testGetFirst();
+        void testGetLast();
+        void testClear();
+        void testIndexOf();
+        void testLastIndexOf();
+        void testContains();
+        void testContainsAll();
+        void testToArray();
+        void testOffer();
+        void testPoll();
+        void testPeek();
+        void testElement();
+        void testQRemove();
+        void testOfferFirst();
+        void testOfferLast();
+        void testRemoveFirst();
+        void testRemoveLast();
+        void testPollFirst();
+        void testPollLast();
+        void testPeekFirst();
+        void testPeekLast();
+        void testPop();
+        void testPush();
+        void testIterator1();
+        void testIterator2();
+        void testListIterator1();
+        void testListIterator2();
+        void testListIterator3();
+        void testListIterator4();
+        void testListIterator1IndexOutOfBoundsException();
+        void testListIterator2IndexOutOfBoundsException();
+        void testDescendingIterator();
+        void testRemoveFirstOccurrence();
+        void testRemoveLastOccurrence();
+
+    };
+
+}}
+
+#endif /* _DECAF_UTIL_LINKEDLISTTEST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/LinkedListTest.h
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message