/** * Test method: long getRank0(int i) * * @throws Exception */ public void testGetRank0() throws Exception { BitMap instance = new BitMap(2048); ArrayList<Long> test = new ArrayList<Long>(); long count = 0; for (int i = 0; i < 2048; i++) { if ((int) (Math.random() * 2) == 1) { instance.setBit(i); } else { count++; } test.add(count); } for (int i = 0; i < test.size(); i++) { assertEquals(instance.getRank0(i), (long) test.get(i)); } }
/** * Test method: long getRank0(int i) * * @throws Exception */ public void testGetRank0() throws Exception { BitMap B = new BitMap(2048); for (int i = 0; i < 2048; i++) { if ((int) (Math.random() * 2) == 1) { B.setBit(i); } } Dictionary instance = new Dictionary(B); for (int i = 0; i < 2048; i++) { assertEquals(B.getRank0(i), instance.getRank0(i)); } }