use of org.develnext.jphp.core.tokenizer.token.expr.operator.LogicOperatorExprToken in project jphp by jphp-compiler.
the class ASMExpressionTest method testPriorities.
@Test
public void testPriorities() {
Assert.assertEquals("123/+", getASMExpression("1 + 2 / 3").getResult().getWord());
Assert.assertEquals("123*+", getASMExpression("1 + 2 * 3").getResult().getWord());
Assert.assertEquals("123%+", getASMExpression("1 + 2 % 3").getResult().getWord());
Assert.assertEquals("12*3/", getASMExpression("1 * 2 / 3").getResult().getWord());
Assert.assertEquals("12/3%", getASMExpression("1 / 2 % 3").getResult().getWord());
Assert.assertEquals("12/3/", getASMExpression("1 / 2 / 3").getResult().getWord());
Assert.assertEquals("12-3+", getASMExpression("1 - 2 + 3").getResult().getWord());
ExprStmtToken expr = getASMExpression("1 && 2 + 3").getResult();
Assert.assertEquals("1&&", expr.getWord());
Assert.assertTrue(expr.getTokens().get(1) instanceof LogicOperatorExprToken);
Assert.assertEquals("2+3", ((LogicOperatorExprToken) expr.getTokens().get(1)).getRightValue().getWord());
Assert.assertEquals("1||", getASMExpression("1 || 2 + 3").getResult().getWord());
Assert.assertEquals("1||", getASMExpression("1 || 2 && 3").getResult().getWord());
Assert.assertEquals("1!||", getASMExpression("!1 || 2 && 3").getResult().getWord());
}
Aggregations