}
public void testRemoveAllTCollection() {
int element_count = 20;
TIntList other = new TIntLinkedList();
for ( int i = 0; i < element_count; i++ ) {
other.add( i );
}
TIntList list = new TIntLinkedList( 20 );
for ( int i = 0; i < element_count; i++ ) {
list.add( i );
}
assertEquals( element_count, list.size() );
assertEquals( element_count, other.size() );
assertTrue( list.removeAll( list ) );
assertEquals( 0, list.size() );
assertTrue( list.isEmpty() );
// Reset the list
list = new TIntLinkedList( 20 );
for ( int i = 0; i < element_count; i++ ) {
list.add( i );
}
assertTrue( list.removeAll( other ) );
assertEquals( 0, list.size() );
assertTrue( list.isEmpty() );
for ( int i = 0; i < list.size(); i++ ) {
assertEquals( i , list.get( i ) );
}
// Reset the list
list = new TIntLinkedList( 20 );
for ( int i = 0; i < element_count; i++ ) {
list.add( i );
}
other.remove( 0 );
other.remove( 5 );
other.remove( 10 );
other.remove( 15 );
assertTrue( list.removeAll( other ) );
int expected = 4;
assertEquals( "expected: " + expected + ", was: " + list.size() + ", list: " + list ,
expected, list.size() );
for ( int i = 0; i < list.size(); i++ ) {
expected = i * 5;
assertEquals( "expected: " + expected + ", was: " + list.get( i ) + ", list: " + list,
expected , list.get( i ) );
}
}