1 package gnu.trove; 2 3 import junit.framework.TestCase; 4 5 import java.util.Arrays ; 6 7 8 11 public class TArrayListTest extends TestCase { 12 13 public void setUp() throws Exception { 14 super.setUp(); 15 } 16 17 public void tearDown() throws Exception { 18 super.tearDown(); 19 } 20 21 22 public void testToNativeArray() { 23 TIntArrayList list = new TIntArrayList(); 24 list.add( 1 ); 25 list.add( 2 ); 26 list.add( 3 ); 27 list.add( 4 ); 28 list.add( 5 ); 29 30 assertTrue( Arrays.equals( new int[] { 1, 2, 3, 4, 5 }, list.toNativeArray() ) ); 31 assertTrue( Arrays.equals( new int[] { 1, 2, 3, 4 }, list.toNativeArray( 0, 4 ) ) ); 32 assertTrue( Arrays.equals( new int[] { 2, 3, 4, 5 }, list.toNativeArray( 1, 4 ) ) ); 33 assertTrue( Arrays.equals( new int[] { 2, 3, 4 }, list.toNativeArray( 1, 3 ) ) ); 34 } 35 } 36 | Popular Tags |