private static void runRandomTest(final int wordLength,final int bytePadding,final int wordCount){
  final long seed=randomLong();
  final Random random=new Random(seed);
  final Random verificationRandom=new Random(seed);
  final long wordMask;
  if (wordLength == 64) {
    wordMask=~0L;
  }
 else {
    wordMask=(1L << wordLength) - 1L;
  }
  final BigEndianAscendingWordSerializer serializer=new BigEndianAscendingWordSerializer(wordLength,wordCount,bytePadding);
  for (int i=0; i < wordCount; i++) {
    final long value=random.nextLong() & wordMask;
    serializer.writeWord(value);
  }
  final byte[] bytes=serializer.getBytes();
  final BigEndianAscendingWordDeserializer deserializer=new BigEndianAscendingWordDeserializer(wordLength,bytePadding,bytes);
  assertEquals(deserializer.totalWordCount(),wordCount);
  for (int i=0; i < wordCount; i++) {
    assertEquals(deserializer.readWord(),(verificationRandom.nextLong() & wordMask));
  }
}

private static void runRandomTest ( final int wordLength , final int bytePadding , final int wordCount ) { final long seed = randomLong ( ) ; final Random random = new Random ( seed ) ; final Random verificationRandom = new Random ( seed ) ; final long wordMask ; if ( wordLength == 64 ) { wordMask = ~ 0L ; } else { wordMask = ( 1L << wordLength ) - 1L ; } final BigEndianAscendingWordSerializer serializer = new BigEndianAscendingWordSerializer ( wordLength , wordCount , bytePadding ) ; for ( int i = 0 ; i < wordCount ; i ++ ) { final long value = random . nextLong ( ) & wordMask ; serializer . writeWord ( value ) ; } final byte [ ] bytes = serializer . getBytes ( ) ; final BigEndianAscendingWordDeserializer deserializer = new BigEndianAscendingWordDeserializer ( wordLength , bytePadding , bytes ) ; assertEquals ( deserializer . totalWordCount ( ) , wordCount ) ; for ( int i = 0 ; i < wordCount ; i ++ ) { assertEquals ( deserializer . readWord ( ) , ( verificationRandom . nextLong ( ) & wordMask ) ) ; } }
runs a test which serializes and deserializes random word values .
