Search in sources :

Example 1 with Operator

use of cn.taketoday.expression.spel.ast.Operator in project today-framework by TAKETODAY.

the class OperatorTests method testOperatorNames.

@Test
void testOperatorNames() {
    Operator node = getOperatorNode((SpelExpression) parser.parseExpression("1==3"));
    assertThat(node.getOperatorName()).isEqualTo("==");
    node = getOperatorNode((SpelExpression) parser.parseExpression("1!=3"));
    assertThat(node.getOperatorName()).isEqualTo("!=");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3/3"));
    assertThat(node.getOperatorName()).isEqualTo("/");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3+3"));
    assertThat(node.getOperatorName()).isEqualTo("+");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3-3"));
    assertThat(node.getOperatorName()).isEqualTo("-");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3<4"));
    assertThat(node.getOperatorName()).isEqualTo("<");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3<=4"));
    assertThat(node.getOperatorName()).isEqualTo("<=");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3*4"));
    assertThat(node.getOperatorName()).isEqualTo("*");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3%4"));
    assertThat(node.getOperatorName()).isEqualTo("%");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3>=4"));
    assertThat(node.getOperatorName()).isEqualTo(">=");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3 between 4"));
    assertThat(node.getOperatorName()).isEqualTo("between");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3 ^ 4"));
    assertThat(node.getOperatorName()).isEqualTo("^");
}
Also used : Operator(cn.taketoday.expression.spel.ast.Operator) SpelExpression(cn.taketoday.expression.spel.standard.SpelExpression) Test(org.junit.jupiter.api.Test)

Example 2 with Operator

use of cn.taketoday.expression.spel.ast.Operator in project today-infrastructure by TAKETODAY.

the class OperatorTests method testOperatorNames.

@Test
void testOperatorNames() {
    Operator node = getOperatorNode((SpelExpression) parser.parseExpression("1==3"));
    assertThat(node.getOperatorName()).isEqualTo("==");
    node = getOperatorNode((SpelExpression) parser.parseExpression("1!=3"));
    assertThat(node.getOperatorName()).isEqualTo("!=");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3/3"));
    assertThat(node.getOperatorName()).isEqualTo("/");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3+3"));
    assertThat(node.getOperatorName()).isEqualTo("+");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3-3"));
    assertThat(node.getOperatorName()).isEqualTo("-");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3<4"));
    assertThat(node.getOperatorName()).isEqualTo("<");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3<=4"));
    assertThat(node.getOperatorName()).isEqualTo("<=");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3*4"));
    assertThat(node.getOperatorName()).isEqualTo("*");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3%4"));
    assertThat(node.getOperatorName()).isEqualTo("%");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3>=4"));
    assertThat(node.getOperatorName()).isEqualTo(">=");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3 between 4"));
    assertThat(node.getOperatorName()).isEqualTo("between");
    node = getOperatorNode((SpelExpression) parser.parseExpression("3 ^ 4"));
    assertThat(node.getOperatorName()).isEqualTo("^");
}
Also used : Operator(cn.taketoday.expression.spel.ast.Operator) SpelExpression(cn.taketoday.expression.spel.standard.SpelExpression) Test(org.junit.jupiter.api.Test)

Aggregations

Operator (cn.taketoday.expression.spel.ast.Operator)2 SpelExpression (cn.taketoday.expression.spel.standard.SpelExpression)2 Test (org.junit.jupiter.api.Test)2