コード例 #1
0
  /** Test a three-level string */
  @Test
  public void testThreeLevelCase() {
    try {
      SymbolNode list = testee.parse("(A (B B (C C C)))");

      assertEquals(list.toString(), "(A (B B (C C C)))");
    } catch (IllegalSymbolInputException isie) {
      fail("No exception expected here");
    }
  }
コード例 #2
0
  /** Test a complete SimSpark-like String */
  @Test
  public void testSimSparkComplete() {
    try {
      SymbolNode list =
          testee.parse(
              "(time (now 51.82))(GS (t 0.00) (pm BeforeKickOff))(GYR (n torso) (rt 0.00 -0.00 0.00))(HJ (n hj1) (ax -0.00))(HJ (n hj2) (ax -0.00))(HJ (n raj1) (ax -0.00))(HJ (n raj2) (ax -0.00))(HJ (n raj3) (ax -0.00))(HJ (n raj4) (ax -0.00))(HJ (n laj1) (ax -0.00))(HJ (n laj2) (ax -0.00))(HJ (n laj3) (ax -0.00))(HJ (n laj4) (ax -0.00))(HJ (n rlj1) (ax -0.00))(HJ (n rlj2) (ax -0.00))(HJ (n rlj3) (ax -0.00))(HJ (n rlj4) (ax -0.00))(HJ (n rlj5) (ax -0.00))(HJ (n rlj6) (ax -0.00))(HJ (n llj1) (ax -0.00))(HJ (n llj2) (ax -0.00))(HJ (n llj3) (ax -0.00))(HJ (n llj4) (ax -0.00))(HJ (n llj5) (ax -0.00))(HJ (n llj6) (ax -0.00))");

      assertTrue(list.getChild(0) instanceof SymbolNode);

      SymbolNode timeNode = (SymbolNode) list.getChild(0);
      SymbolNode timeSubNode = (SymbolNode) timeNode.getChild(1);
      assertEquals(timeNode.getChild(0).content(), "time");
      assertEquals(timeSubNode.getChild(0).content(), "now");
      assertEquals(timeSubNode.getChild(1).content(), "51.82");

      SymbolNode gameStateNode = (SymbolNode) list.getChild(1);
      SymbolNode gameStateSubNode = (SymbolNode) gameStateNode.getChild(1);
      assertEquals(gameStateNode.getChild(0).content(), "GS");
      assertEquals(gameStateSubNode.getChild(0).content(), "t");
      assertEquals(gameStateSubNode.getChild(1).content(), "0.00");
    } catch (IllegalSymbolInputException isie) {
      fail("No exception expected here");
    }
  }