1 package org.apache.poi.util; 2 3 import junit.framework.TestCase; 4 5 8 public class TestIntList2d 9 extends TestCase 10 { 11 public void testAccess() 12 throws Exception 13 { 14 IntList2d array = new IntList2d(); 15 assertEquals( 0, array.get( 0, 0 ) ); 16 assertEquals( 0, array.get( 1, 1 ) ); 17 assertEquals( 0, array.get( 100, 100 ) ); 18 array.set( 100, 100, 999 ); 19 assertEquals( 999, array.get( 100, 100 ) ); 20 assertEquals( 0, array.get( 0, 0 ) ); 21 array.set( 0, 0, 999 ); 22 assertEquals( 999, array.get( 0, 0 ) ); 23 24 assertTrue(array.isAllocated( 0, 0 ) ); 25 assertTrue(array.isAllocated( 100, 100 ) ); 26 assertFalse(array.isAllocated( 200, 200 ) ); 27 28 try 29 { 30 assertEquals( 0, array.get( -1, -1 ) ); 31 fail(); 32 } 33 catch ( ArrayIndexOutOfBoundsException e ) 34 { 35 } 37 } 38 } 39 | Popular Tags |