Package net.sf.jabref.bst

Examples of net.sf.jabref.bst.VM.run()


    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    v.add(t1BibtexEntry());
   
    String expected = "\\begin{thebibliography}{1}\\bibitem{canh05}K.~Crowston, H.~Annabi, J.~Howison, and C.~Masango.\\newblock Effective work practices for floss development: A model and  propositions.\\newblock In {\\em Hawaii International Conference On System Sciences (HICSS)}, 2005.\\end{thebibliography}";
   
    assertEquals(expected.replaceAll("\\s", ""), vm.run(v).replaceAll("\\s", ""));
  }

  public void testVMSimple() throws RecognitionException, IOException {

    VM vm = new VM("" + "ENTRY  { " + "  address " + "  author " + "  title " + "  type "
View Full Code Here


      + "STRINGS { s t } " + "READ");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    v.add(t1BibtexEntry());

    vm.run(v);

    assertEquals(2, vm.getStrings().size());
    assertEquals(7, vm.getIntegers().size());
    assertEquals(1, vm.getEntries().size());
    assertEquals(5, (vm.getEntries().get(0)).getFields().size());
View Full Code Here

      + "ITERATE { test }");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    v.add(t1BibtexEntry());

    vm.run(v);

    assertEquals("Effective work practices for floss development: A model and propositions", vm
      .getStack().pop());

  }
View Full Code Here

  public void testQuote() throws RecognitionException, IOException {

    VM vm = new VM("FUNCTION {a}{ quote$ quote$ * } EXECUTE {a}");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    vm.run(v);

    assertEquals("\"\"", vm.getStack().pop());
  }

  public void testVMFunction1() throws RecognitionException, IOException {
View Full Code Here

  public void testVMFunction1() throws RecognitionException, IOException {

    VM vm = new VM("FUNCTION {init.state.consts}{ #0 'before.all := } ");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    vm.run(v);

    assertEquals(38, vm.getFunctions().size());

    assertTrue(vm.getFunctions().get("init.state.consts") instanceof StackFunction);
View Full Code Here

      VM vm = new VM("" + "INTEGERS { variable.a } "
        + "FUNCTION {init.state.consts}{ #5 'variable.a := } "
        + "EXECUTE {init.state.consts}");

      Vector<BibtexEntry> v = new Vector<BibtexEntry>();
      vm.run(v);
      assertEquals(new Integer(5), vm.getIntegers().get("variable.a"));
    }
    {
      VM vm = new VM("FUNCTION {a}{ #5 #5 = " + "#1 #2 = " + "#3 #4 < " + "#4 #3 < "
        + "#4 #4 < " + "#3 #4 > " + "#4 #3 > " + "#4 #4 > " + "\"H\" \"H\" = "
View Full Code Here

      VM vm = new VM("FUNCTION {a}{ #5 #5 = " + "#1 #2 = " + "#3 #4 < " + "#4 #3 < "
        + "#4 #4 < " + "#3 #4 > " + "#4 #3 > " + "#4 #4 > " + "\"H\" \"H\" = "
        + "\"H\" \"Ha\" = } " + "EXECUTE {a}");

      Vector<BibtexEntry> v = new Vector<BibtexEntry>();
      vm.run(v);

      assertEquals(VM.FALSE, vm.getStack().pop());
      assertEquals(VM.TRUE, vm.getStack().pop());
      assertEquals(VM.FALSE, vm.getStack().pop());
      assertEquals(VM.TRUE, vm.getStack().pop());
View Full Code Here

      + "FUNCTION {or}  {   { pop$ #1 }      'skip$    if$  }" + "FUNCTION {test} { "
      + "#1 #1 and #0 #1 and #1 #0 and #0 #0 and " + "#0 not #1 not "
      + "#1 #1 or #0 #1 or #1 #0 or #0 #0 or }" + "EXECUTE {test}");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    vm.run(v);
    assertEquals(VM.FALSE, vm.getStack().pop());
    assertEquals(VM.TRUE, vm.getStack().pop());
    assertEquals(VM.TRUE, vm.getStack().pop());
    assertEquals(VM.TRUE, vm.getStack().pop());
    assertEquals(VM.FALSE, vm.getStack().pop());
View Full Code Here

  public void testVMArithmetic() throws RecognitionException, IOException {
    {
      VM vm = new VM("FUNCTION {test} { " + "#1 #1 + #5 #2 - }" + "EXECUTE {test}");

      Vector<BibtexEntry> v = new Vector<BibtexEntry>();
      vm.run(v);
      assertEquals(new Integer(3), vm.getStack().pop());
      assertEquals(new Integer(2), vm.getStack().pop());
      assertEquals(0, vm.getStack().size());
    }
    {
View Full Code Here

      VM vm = new VM("FUNCTION {test} { " + "#1 \"HELLO\" + #5 #2 - }" + "EXECUTE {test}");

      Vector<BibtexEntry> v = new Vector<BibtexEntry>();

      try {
        vm.run(v);
        fail();
      } catch (VMException e) {

      }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.