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()); }
public void testMultiplicative() { expr = (ASBinaryExpression) fact.newExpression("1 * 2 * 2"); Expression left = fact.newIntegerLiteral(1); expr.setLeftSubexpression(left); }
public void testAdditive() { expr = (ASBinaryExpression) fact.newExpression("1 + 2 + 2"); Expression left = fact.newIntegerLiteral(1); expr.setLeftSubexpression(left); }
public void testShift() { expr = (ASBinaryExpression) fact.newExpression("a << b << c"); Expression left = fact.newExpression("foo"); expr.setLeftSubexpression(left); }
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); }
public void testEquality() { expr = (ASBinaryExpression) fact.newExpression("a == b == c"); Expression left = fact.newExpression("foo"); expr.setLeftSubexpression(left); }
public void testBitAnd() { expr = (ASBinaryExpression) fact.newExpression("a & b & c"); Expression left = fact.newExpression("foo"); expr.setLeftSubexpression(left); }
public void testXor() { expr = (ASBinaryExpression) fact.newExpression("a ^ b ^ c"); Expression left = fact.newExpression("foo"); expr.setLeftSubexpression(left); }
public void testLogicalOr() { expr = (ASBinaryExpression) fact.newExpression("a || b || c"); Expression left = fact.newExpression("foo"); expr.setLeftSubexpression(left); }