public void testBasic() {
   // pathenthesised expressions control evaluation order, but
   // don't have any other meaning, therefore metaas doesn't
   // expose them in the DOM, except in their implied effect on
   // the expression tree structure.
   Expression expr = fact.newExpression("(1+1)");
   assertTrue(expr instanceof ASBinaryExpression);
   assertEquals(ASBinaryExpression.Op.ADD, ((ASBinaryExpression) expr).getOperator());
 }
Пример #2
0
 public void testMultiplicative() {
   expr = (ASBinaryExpression) fact.newExpression("1 * 2 * 2");
   Expression left = fact.newIntegerLiteral(1);
   expr.setLeftSubexpression(left);
 }
Пример #3
0
 public void testAdditive() {
   expr = (ASBinaryExpression) fact.newExpression("1 + 2 + 2");
   Expression left = fact.newIntegerLiteral(1);
   expr.setLeftSubexpression(left);
 }
Пример #4
0
 public void testShift() {
   expr = (ASBinaryExpression) fact.newExpression("a << b << c");
   Expression left = fact.newExpression("foo");
   expr.setLeftSubexpression(left);
 }
Пример #5
0
 public void testRelational() {
   // not strictly possible (I wonder if the grammar should forbid?)
   expr = (ASBinaryExpression) fact.newExpression("a < b < c");
   Expression left = fact.newExpression("foo");
   expr.setLeftSubexpression(left);
 }
Пример #6
0
 public void testEquality() {
   expr = (ASBinaryExpression) fact.newExpression("a == b == c");
   Expression left = fact.newExpression("foo");
   expr.setLeftSubexpression(left);
 }
Пример #7
0
 public void testBitAnd() {
   expr = (ASBinaryExpression) fact.newExpression("a & b & c");
   Expression left = fact.newExpression("foo");
   expr.setLeftSubexpression(left);
 }
Пример #8
0
 public void testXor() {
   expr = (ASBinaryExpression) fact.newExpression("a ^ b ^ c");
   Expression left = fact.newExpression("foo");
   expr.setLeftSubexpression(left);
 }
Пример #9
0
 public void testLogicalOr() {
   expr = (ASBinaryExpression) fact.newExpression("a || b || c");
   Expression left = fact.newExpression("foo");
   expr.setLeftSubexpression(left);
 }