1 package jalview.ext.android;
3 import static org.testng.Assert.assertEquals;
5 import org.testng.annotations.Test;
8 * Tests for SparseIntArray. Unlike SparseShortArray, SparseIntArray does not throw
9 * any exception for overflow.
11 public class SparseIntArrayTest
13 @Test(groups = "Functional")
16 SparseIntArray counter = new SparseIntArray();
19 * either key or value may be in the range of int
21 counter.put(Integer.MAX_VALUE, Integer.MIN_VALUE);
22 counter.put(Integer.MIN_VALUE, Integer.MAX_VALUE);
23 assertEquals(counter.get(Integer.MAX_VALUE), Integer.MIN_VALUE);
24 assertEquals(counter.get(Integer.MIN_VALUE), Integer.MAX_VALUE);
27 @Test(groups = "Functional")
30 SparseIntArray counter = new SparseIntArray();
32 assertEquals(counter.add('P', 2), 2);
33 assertEquals(counter.add('P', 3), 5);
35 assertEquals(counter.add('Q', 4), 11);
37 counter.put('x', Integer.MAX_VALUE);
40 counter.put('y', Integer.MIN_VALUE);