Пример #1
0
  @Test
  public void testEqual() throws InvalidSemanticsException, InvalidArgumentsException {
    for (int i = 1; i < 10; i++) {
      int x = myRandom.nextInt(i * 100);
      int y = myRandom.nextInt(i * 100);

      List<SyntaxNode> n = myParser.parseCommand("equal? " + x + " " + y);
      int val = (x == y) ? 1 : 0;

      assertEquals(n.get(0).evaluate(null), val);
      n = myParser.parseCommand("equalp " + x + " " + y);
      assertEquals(n.get(0).evaluate(null), val);
    }
  }
Пример #2
0
  @Test
  public void testNot() throws InvalidSemanticsException, InvalidArgumentsException {
    for (int i = 1; i < 10; i++) {
      int x = myRandom.nextInt(1);

      List<SyntaxNode> n = myParser.parseCommand("not " + x);

      int val = (x == 1) ? 0 : 1;

      assertEquals(n.get(0).evaluate(null), val);
    }
  }