Ejemplo n.º 1
0
 public static final void main(String[] test) {
   final String alphabet = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   Index index = new Index(20);
   for (int cc = 0; cc < 62; cc++) {
     Character key = new Character(alphabet.charAt(cc));
     index.add(key, cc);
   }
   index.distribution(false, System.out);
   int failure = 0;
   for (int cc = 0; cc < 62; cc++) {
     Character key = new Character(alphabet.charAt(cc));
     int idx = index.get(key);
     if (-1 == idx) {
       failure++;
       System.out.println("Test failed for key '" + key + "'.");
     }
   }
   if (0 == failure) System.out.println("Test passed.");
   System.exit(failure);
 }