use of org.kie.dmn.feel.lang.ast.SignedUnaryNode in project drools by kiegroup.
the class FEELParserTest method testNegativeIntegerLiteral.
@Test
public void testNegativeIntegerLiteral() {
String inputExpression = "-10";
BaseNode number = parse(inputExpression);
assertThat(number, is(instanceOf(SignedUnaryNode.class)));
assertThat(number.getResultType(), is(BuiltInType.NUMBER));
assertLocation(inputExpression, number);
SignedUnaryNode sun = (SignedUnaryNode) number;
assertThat(sun.getSign(), is(SignedUnaryNode.Sign.NEGATIVE));
assertThat(sun.getExpression(), is(instanceOf(NumberNode.class)));
assertThat(sun.getExpression().getText(), is("10"));
}
use of org.kie.dmn.feel.lang.ast.SignedUnaryNode in project drools by kiegroup.
the class FEELParserTest method testPositiveIntegerLiteral.
@Test
public void testPositiveIntegerLiteral() {
String inputExpression = "+10";
BaseNode number = parse(inputExpression);
assertThat(number, is(instanceOf(SignedUnaryNode.class)));
assertThat(number.getResultType(), is(BuiltInType.NUMBER));
assertLocation(inputExpression, number);
SignedUnaryNode sun = (SignedUnaryNode) number;
assertThat(sun.getSign(), is(SignedUnaryNode.Sign.POSITIVE));
assertThat(sun.getExpression(), is(instanceOf(NumberNode.class)));
assertThat(sun.getExpression().getText(), is("10"));
}
use of org.kie.dmn.feel.lang.ast.SignedUnaryNode in project drools by kiegroup.
the class FEELParserTest method testPositiveFloatLiteral.
@Test
public void testPositiveFloatLiteral() {
String inputExpression = "+10.5";
BaseNode number = parse(inputExpression);
assertThat(number, is(instanceOf(SignedUnaryNode.class)));
assertThat(number.getResultType(), is(BuiltInType.NUMBER));
assertLocation(inputExpression, number);
SignedUnaryNode sun = (SignedUnaryNode) number;
assertThat(sun.getSign(), is(SignedUnaryNode.Sign.POSITIVE));
assertThat(sun.getExpression(), is(instanceOf(NumberNode.class)));
assertThat(sun.getExpression().getText(), is("10.5"));
}
use of org.kie.dmn.feel.lang.ast.SignedUnaryNode in project drools by kiegroup.
the class FEELParserTest method testNegativeFloatLiteral.
@Test
public void testNegativeFloatLiteral() {
String inputExpression = "-10.5";
BaseNode number = parse(inputExpression);
assertThat(number, is(instanceOf(SignedUnaryNode.class)));
assertThat(number.getResultType(), is(BuiltInType.NUMBER));
assertLocation(inputExpression, number);
SignedUnaryNode sun = (SignedUnaryNode) number;
assertThat(sun.getSign(), is(SignedUnaryNode.Sign.NEGATIVE));
assertThat(sun.getExpression(), is(instanceOf(NumberNode.class)));
assertThat(sun.getExpression().getText(), is("10.5"));
}
Aggregations