Code example for BitSet

Methods: get, length, set, size

0
        bs2.set(127);
        bs2.flip(0, 128);
        resultbs = bs2.get(0, bs.size());
        assertEquals("equality principle 3 ", resultbs, bs2);
 
        bs = new BitSet(0);
        assertEquals("Test1: Wrong length,", 0, bs.length());
        assertEquals("Test1: Wrong size,", 0, bs.size());
 
        bs.get(0, 2);
        assertEquals("Test2: Wrong length,", 0, bs.length());
        assertEquals("Test2: Wrong size,", 0, bs.size());
 
        bs.get(60, 64);
        assertEquals("Test3: Wrong length,", 0, bs.length());
        assertEquals("Test3: Wrong size,", 0, bs.size());
 
        bs.get(64, 120);
        assertEquals("Test4: Wrong length,", 0, bs.length());
        assertEquals("Test4: Wrong size,", 0, bs.size());
 
        bs.set(25);
        assertEquals("Test5: Wrong length,", 26, bs.length());
        assertEquals("Test5: Wrong size,", 64, bs.size());
 
        bs.get(60, 64);
        assertEquals("Test6: Wrong length,", 26, bs.length());
        assertEquals("Test6: Wrong size,", 64, bs.size());
 
        bs.get(64, 120);
        assertEquals("Test7: Wrong size,", 64, bs.size());
        assertEquals("Test7: Wrong length,", 26, bs.length());
 
        bs.get(80);
        assertEquals("Test8: Wrong size,", 64, bs.size());
        assertEquals("Test8: Wrong length,", 26, bs.length());
 
        bs.get(25);
        assertEquals("Test9: Wrong size,", 64, bs.size());
        assertEquals("Test9: Wrong length,", 26, bs.length());
 
    } 
 
    /** 
     * @tests java.util.BitSet#flip(int)