use of org.ballerinalang.model.values.BFloat in project ballerina by ballerina-lang.
the class BFloatValueTest method testFloatValue.
@Test(description = "Test double value assignment")
public void testFloatValue() {
BValue[] returns = BRunUtil.invoke(result, "testFloatValue", new BValue[] {});
Assert.assertEquals(returns.length, 1);
Assert.assertSame(returns[0].getClass(), BFloat.class);
BFloat floatValue = (BFloat) returns[0];
Assert.assertEquals(floatValue.floatValue(), 10.1f, DELTA, "Invalid float value returned.");
}
use of org.ballerinalang.model.values.BFloat in project ballerina by ballerina-lang.
the class BFloatValueTest method testFloatValueAddition.
@Test(description = "Test double value Addition")
public void testFloatValueAddition() {
BValue[] returns = BRunUtil.invoke(result, "testFloatAddition", new BValue[] {});
Assert.assertEquals(returns.length, 1);
Assert.assertSame(returns[0].getClass(), BFloat.class);
BFloat floatValue = (BFloat) returns[0];
Assert.assertEquals(floatValue.floatValue(), 20.0d, "Invalid float value returned.");
}
use of org.ballerinalang.model.values.BFloat in project ballerina by ballerina-lang.
the class BFloatValueTest method testFloatParameter.
@Test(description = "Test double value assignment")
public void testFloatParameter() {
BValue[] args = { new BFloat(3.3f) };
BValue[] returns = BRunUtil.invoke(result, "testFloatParameter", args);
Assert.assertEquals(returns.length, 1);
Assert.assertSame(returns[0].getClass(), BFloat.class);
BFloat floatValue = (BFloat) returns[0];
Assert.assertEquals(floatValue.floatValue(), 3.3f, DELTA, "Invalid float value returned.");
}
use of org.ballerinalang.model.values.BFloat in project ballerina by ballerina-lang.
the class WhileStmtTest method testWhileBlockScopesWithIf.
@Test(description = "Check the scope managing in while block with ifelse")
public void testWhileBlockScopesWithIf() {
BValue[] returns = BRunUtil.invoke(positiveCompileResult, "testWhileScopeWithIf");
Assert.assertEquals(returns.length, 2);
Assert.assertSame(returns[0].getClass(), BInteger.class, "Class type of return param1 mismatched");
Assert.assertSame(returns[1].getClass(), BFloat.class, "Class type of return param2 mismatched");
BInteger actual = (BInteger) returns[0];
Assert.assertEquals(actual.intValue(), 2, "mismatched output value");
BFloat sum = (BFloat) returns[1];
Assert.assertEquals(sum.floatValue(), 30.0, "mismatched output value");
}
use of org.ballerinalang.model.values.BFloat in project ballerina by ballerina-lang.
the class NextAfter method execute.
public void execute(Context ctx) {
double a = ctx.getFloatArgument(0);
double b = ctx.getFloatArgument(1);
ctx.setReturnValues(new BFloat(Math.nextAfter(a, b)));
}
Aggregations