Search in sources :

Example 11 with BFloat

use of org.ballerinalang.model.values.BFloat in project ballerina by ballerina-lang.

the class MathTest method testNextDown.

@Test(description = "Test 'nextDown' function in ballerina.lang.math package")
public void testNextDown() {
    BValue[] args = { new BFloat(60984.1) };
    BValue[] returns = BRunUtil.invoke(compileResult, "nextDownTest", args);
    Assert.assertEquals(returns.length, 1);
    Assert.assertEquals(((BFloat) returns[0]).floatValue(), 60984.09999999999, DELTA);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BFloat(org.ballerinalang.model.values.BFloat) Test(org.testng.annotations.Test)

Example 12 with BFloat

use of org.ballerinalang.model.values.BFloat in project ballerina by ballerina-lang.

the class MathTest method testLog1p.

@Test(description = "Test 'log1p' function in ballerina.lang.math package")
public void testLog1p() {
    BValue[] args = { new BFloat(1000) };
    BValue[] returns = BRunUtil.invoke(compileResult, "log1pTest", args);
    Assert.assertEquals(returns.length, 1);
    Assert.assertEquals(((BFloat) returns[0]).floatValue(), 6.90875477931522, DELTA);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BFloat(org.ballerinalang.model.values.BFloat) Test(org.testng.annotations.Test)

Example 13 with BFloat

use of org.ballerinalang.model.values.BFloat in project ballerina by ballerina-lang.

the class MathTest method testSin.

@Test(description = "Test 'sin' function in ballerina.lang.math package")
public void testSin() {
    BValue[] args = { new BFloat(0.7853981633974483) };
    BValue[] returns = BRunUtil.invoke(compileResult, "sinTest", args);
    Assert.assertEquals(returns.length, 1);
    Assert.assertEquals(((BFloat) returns[0]).floatValue(), 0.7071067811865475, DELTA);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BFloat(org.ballerinalang.model.values.BFloat) Test(org.testng.annotations.Test)

Example 14 with BFloat

use of org.ballerinalang.model.values.BFloat in project ballerina by ballerina-lang.

the class MathTest method testRint.

@Test(description = "Test 'rint' function in ballerina.lang.math package")
public void testRint() {
    BValue[] args = { new BFloat(2.50) };
    BValue[] returns = BRunUtil.invoke(compileResult, "rintTest", args);
    Assert.assertEquals(returns.length, 1);
    Assert.assertEquals(((BFloat) returns[0]).floatValue(), 2.0, DELTA);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BFloat(org.ballerinalang.model.values.BFloat) Test(org.testng.annotations.Test)

Example 15 with BFloat

use of org.ballerinalang.model.values.BFloat in project ballerina by ballerina-lang.

the class MathTest method testNextUp.

@Test(description = "Test 'nextUp' function in ballerina.lang.math package")
public void testNextUp() {
    BValue[] args = { new BFloat(-100.675) };
    BValue[] returns = BRunUtil.invoke(compileResult, "nextUpTest", args);
    Assert.assertEquals(returns.length, 1);
    Assert.assertEquals(((BFloat) returns[0]).floatValue(), -100.67499999999998, DELTA);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BFloat(org.ballerinalang.model.values.BFloat) Test(org.testng.annotations.Test)

Aggregations

BFloat (org.ballerinalang.model.values.BFloat)158 BValue (org.ballerinalang.model.values.BValue)119 Test (org.testng.annotations.Test)107 BInteger (org.ballerinalang.model.values.BInteger)55 BString (org.ballerinalang.model.values.BString)41 BBoolean (org.ballerinalang.model.values.BBoolean)21 BRefType (org.ballerinalang.model.values.BRefType)7 BStruct (org.ballerinalang.model.values.BStruct)7 BType (org.ballerinalang.model.types.BType)6 BBlob (org.ballerinalang.model.values.BBlob)6 BStringArray (org.ballerinalang.model.values.BStringArray)5 BStructType (org.ballerinalang.model.types.BStructType)4 BIntArray (org.ballerinalang.model.values.BIntArray)4 UnsupportedFieldTypeException (org.ballerinalang.net.grpc.exception.UnsupportedFieldTypeException)4 BallerinaException (org.ballerinalang.util.exceptions.BallerinaException)4 BJSON (org.ballerinalang.model.values.BJSON)3 CompileResult (org.ballerinalang.launcher.util.CompileResult)2 BMap (org.ballerinalang.model.values.BMap)2 BRefValueArray (org.ballerinalang.model.values.BRefValueArray)2 Message (org.ballerinalang.net.grpc.Message)2