public void testRWBits(){
  final int bSize=32 << 1;
  final int[] bits=new int[bSize];
  final int nbits=bSize * 32;
  for (int i=0; i < nbits; i++) {
    final int b=RWStore.fndBit(bits,bSize);
    assertTrue(b != -1);
    assertFalse(RWStore.tstBit(bits,b));
    RWStore.setBit(bits,b);
    assertTrue(RWStore.tstBit(bits,b));
  }
  assertTrue(-1 == RWStore.fndBit(bits,bSize));
  for (int i=0; i < 30 * 1024 * 1024; i++) {
    final int b=r.nextInt(nbits);
    assertTrue(RWStore.tstBit(bits,b));
    RWStore.clrBit(bits,b);
    assertFalse(RWStore.tstBit(bits,b));
    assertTrue(b == RWStore.fndBit(bits,bSize));
    RWStore.setBit(bits,b);
    assertTrue(RWStore.tstBit(bits,b));
  }
  assertTrue(-1 == RWStore.fndBit(bits,bSize));
}

public void testRWBits ( ) { final int bSize = 32 << 1 ; final int [ ] bits = new int [ bSize ] ; final int nbits = bSize * 32 ; for ( int i = 0 ; i < nbits ; i ++ ) { final int b = RWStore . fndBit ( bits , bSize ) ; assertTrue ( b != - 1 ) ; assertFalse ( RWStore . tstBit ( bits , b ) ) ; RWStore . setBit ( bits , b ) ; assertTrue ( RWStore . tstBit ( bits , b ) ) ; } assertTrue ( - 1 == RWStore . fndBit ( bits , bSize ) ) ; for ( int i = 0 ; i < 30 * 1024 * 1024 ; i ++ ) { final int b = r . nextInt ( nbits ) ; assertTrue ( RWStore . tstBit ( bits , b ) ) ; RWStore . clrBit ( bits , b ) ; assertFalse ( RWStore . tstBit ( bits , b ) ) ; assertTrue ( b == RWStore . fndBit ( bits , bSize ) ) ; RWStore . setBit ( bits , b ) ; assertTrue ( RWStore . tstBit ( bits , b ) ) ; } assertTrue ( - 1 == RWStore . fndBit ( bits , bSize ) ) ; }
the rwstore relies on several bit manipulation methods to manage both fixedallocators and meta allocations . < p > this test stresses these methods .
