示例#1
0
 @Test
 public void testRepeatsIndex() throws Exception {
   TreeWizard wiz = new TreeWizard(adaptor, tokens);
   CommonTree t = (CommonTree) wiz.create("(A B (A C B) B D D)");
   Map<Integer, List<Object>> m = wiz.index(t);
   String found = sortMapToString(m);
   String expecting = "{5=[A, A], 6=[B, B, B], 7=[C], 8=[D, D]}";
   assertEquals(expecting, found);
 }
示例#2
0
 @Test
 public void testSingleNodeIndex() throws Exception {
   TreeWizard wiz = new TreeWizard(adaptor, tokens);
   CommonTree t = (CommonTree) wiz.create("ID");
   Map<Integer, List<Object>> m = wiz.index(t);
   String found = m.toString();
   String expecting = "{10=[ID]}";
   assertEquals(expecting, found);
 }