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);
 }