Search in sources :

Example 1 with FloatLiteral

use of org.yakindu.base.expressions.expressions.FloatLiteral in project statecharts by Yakindu.

the class Assert method assertExpressionEquals.

public static void assertExpressionEquals(String expected, Expression current) {
    String currentValue = null;
    if (current instanceof PrimitiveValueExpression) {
        Literal literal = ((PrimitiveValueExpression) current).getValue();
        if (literal instanceof BoolLiteral) {
            currentValue = Boolean.toString(((BoolLiteral) literal).isValue());
        } else if (literal instanceof IntLiteral) {
            currentValue = Long.toString(((IntLiteral) literal).getValue());
        } else if (literal instanceof DoubleLiteral) {
            currentValue = Double.toString(((DoubleLiteral) literal).getValue());
        } else if (literal instanceof FloatLiteral) {
            currentValue = Double.toString(((FloatLiteral) literal).getValue());
        } else if (literal instanceof StringLiteral) {
            currentValue = (((StringLiteral) literal).getValue());
        }
    }
    assertEquals(expected, currentValue);
}
Also used : BoolLiteral(org.yakindu.base.expressions.expressions.BoolLiteral) StringLiteral(org.yakindu.base.expressions.expressions.StringLiteral) FloatLiteral(org.yakindu.base.expressions.expressions.FloatLiteral) FloatLiteral(org.yakindu.base.expressions.expressions.FloatLiteral) StringLiteral(org.yakindu.base.expressions.expressions.StringLiteral) Literal(org.yakindu.base.expressions.expressions.Literal) DoubleLiteral(org.yakindu.base.expressions.expressions.DoubleLiteral) IntLiteral(org.yakindu.base.expressions.expressions.IntLiteral) BoolLiteral(org.yakindu.base.expressions.expressions.BoolLiteral) IntLiteral(org.yakindu.base.expressions.expressions.IntLiteral) DoubleLiteral(org.yakindu.base.expressions.expressions.DoubleLiteral) PrimitiveValueExpression(org.yakindu.base.expressions.expressions.PrimitiveValueExpression)

Aggregations

BoolLiteral (org.yakindu.base.expressions.expressions.BoolLiteral)1 DoubleLiteral (org.yakindu.base.expressions.expressions.DoubleLiteral)1 FloatLiteral (org.yakindu.base.expressions.expressions.FloatLiteral)1 IntLiteral (org.yakindu.base.expressions.expressions.IntLiteral)1 Literal (org.yakindu.base.expressions.expressions.Literal)1 PrimitiveValueExpression (org.yakindu.base.expressions.expressions.PrimitiveValueExpression)1 StringLiteral (org.yakindu.base.expressions.expressions.StringLiteral)1