assertEquals(0, vm.getStack().size());
}
}
public void testSubstring() throws RecognitionException, IOException {
VM vm = new VM("FUNCTION {test} " + "{ \"123456789\" #2 #1 substring$ " + // 2
" \"123456789\" #4 global.max$ substring$ " + // 456789
" \"123456789\" #1 #9 substring$ " + // 123456789
" \"123456789\" #1 #10 substring$ " + // 123456789
" \"123456789\" #1 #99 substring$ " + // 123456789
" \"123456789\" #-7 #3 substring$ " + // 123
" \"123456789\" #-1 #1 substring$ " + // 9
" \"123456789\" #-1 #3 substring$ " + // 789
" \"123456789\" #-2 #2 substring$ " + // 78
"} EXECUTE {test} ");
Vector<BibtexEntry> v = new Vector<BibtexEntry>();
vm.run(v);
assertEquals("78", vm.getStack().pop());
assertEquals("789", vm.getStack().pop());
assertEquals("9", vm.getStack().pop());
assertEquals("123", vm.getStack().pop());
assertEquals("123456789", vm.getStack().pop());
assertEquals("123456789", vm.getStack().pop());
assertEquals("123456789", vm.getStack().pop());
assertEquals("456789", vm.getStack().pop());
assertEquals("2", vm.getStack().pop());
assertEquals(0, vm.getStack().size());
}