Advertisement
DanFloyd

VocTest

Mar 29th, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.14 KB | None | 0 0
  1. public class VocTest
  2. {
  3.     public static void main(String args[])
  4.     {
  5.         System.out.println("### Voc Tester ###\n");
  6.         System.out.println("# Creating new voc...");
  7.         Voc vb = new Voc();
  8.         System.out.println("# Is the voc empty...? "+ vb.isEmpty());
  9.         System.out.println("# Here's voc representation:");
  10.         System.out.println(vb.toString());
  11.         System.out.println("# Is the representation invariant satisfied...? "+ vb.repOk());
  12.         System.out.println("# Done !\n");
  13.  
  14.         System.out.println("# Add 00aa->apple...");
  15.         vb.insertTuple("00aa","apple");
  16.         System.out.println("# Here is the voc representation:");
  17.         System.out.println(vb.toString());
  18.         System.out.println("# Is the voc empty...? "+ vb.isEmpty());
  19.         System.out.println("# Is key '00aa' in...? "+ vb.isIn("00aa"));
  20.         System.out.println("# Is key '99zz' in...? "+ vb.isIn("99zz"));
  21.         System.out.println("# Is the representation invariant satisfied...? "+ vb.repOk());
  22.         System.out.println("# Done !\n");
  23.  
  24.         System.out.println("# Add some Tuples...");
  25.         vb.insertTuple("22xw","strawberry");
  26.         vb.insertTuple("32fr","santana");
  27.         vb.insertTuple("98io","programmazione2");
  28.         vb.insertTuple("21cd","tagomago");
  29.         vb.insertTuple("52wb","pinkfloyd");
  30.         vb.insertTuple("95hj","sole");
  31.         vb.insertTuple("32po","luna");
  32.         vb.insertTuple("78kk","spillo");
  33.         vb.insertTuple("34fi","tequila");
  34.         vb.insertTuple("84zl","patagonia");
  35.         System.out.println("# Here's the voc representation:");
  36.         System.out.println(vb.toString());
  37.         System.out.println("# Is the voc empty...? "+ vb.isEmpty());
  38.         System.out.println("# Is key '52wb' in...? "+ vb.isIn("52wb"));
  39.         System.out.println("# So gimme the value...! "+ vb.searchTuple("52wb"));
  40.         System.out.println("# Is key '99zz' in...? "+ vb.isIn("99zz"));
  41.         System.out.println("# Is the representation invariant satisfied...? "+ vb.repOk());
  42.         System.out.println("# Done !\n");
  43.  
  44.         System.out.println("# Add 34fi->whiterussian... (refresh test)");
  45.         System.out.println("# Here's the old voc representation:");
  46.         System.out.println(vb.toString());
  47.         System.out.println("# Gimme the old value...! "+ vb.searchTuple("34fi"));
  48.         vb.insertTuple("34fi","whiterussian");
  49.         System.out.println("# Here's the nu voc representation:");
  50.         System.out.println(vb.toString());
  51.         System.out.println("# So gimme the nu value...! "+ vb.searchTuple("34fi"));
  52.         System.out.println("# Is the representation invariant satisfied...? "+ vb.repOk());
  53.         System.out.println("# Done !\n");
  54.  
  55.         System.out.println("# Remove some Tuples...");
  56.         vb.removeTuple("22xw");
  57.         vb.removeTuple("32fr");
  58.         vb.removeTuple("00aa");
  59.         vb.removeTuple("95hj");
  60.         vb.removeTuple("34fi");
  61.         System.out.println("# Here's the voc representation:");
  62.         System.out.println(vb.toString());
  63.         System.out.println("# Is the voc empty...? "+ vb.isEmpty());
  64.         System.out.println("# Is key '52wb' in...? "+ vb.isIn("52wb"));
  65.         System.out.println("# So gimme the value...! "+ vb.searchTuple("52wb"));
  66.         System.out.println("# Is key '22xw' in...? "+ vb.isIn("22xw"));
  67.         System.out.println("# Is the representation invariant satisfied...? "+ vb.repOk());
  68.         System.out.println("# Done !\n");
  69.        
  70.         System.out.println("# Seeya! :)");
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement