use of org.ballerinalang.model.values.BInteger in project ballerina by ballerina-lang.
the class BIntegerValueTest method testIntegerValueDivision.
@Test(description = "Test long value Division")
public void testIntegerValueDivision() {
BValue[] returns = BRunUtil.invoke(result, "testIntegerDivision", new BValue[] {});
Assert.assertEquals(returns.length, 1);
Assert.assertSame(returns[0].getClass(), BInteger.class);
BInteger intValue = (BInteger) returns[0];
Assert.assertEquals(intValue.intValue(), 5, "Invalid int value returned.");
}
use of org.ballerinalang.model.values.BInteger in project ballerina by ballerina-lang.
the class BIntegerValueTest method testIntegerValueAssignmentByReturnValue.
@Test(description = "Test long value assignment from a value returned by function")
public void testIntegerValueAssignmentByReturnValue() {
BValue[] returns = BRunUtil.invoke(result, "testIntegerValueAssignmentByReturnValue", new BValue[] {});
Assert.assertEquals(returns.length, 1);
Assert.assertSame(returns[0].getClass(), BInteger.class);
BInteger intValue = (BInteger) returns[0];
Assert.assertEquals(intValue.intValue(), 10, "Invalid int value returned.");
}
use of org.ballerinalang.model.values.BInteger in project ballerina by ballerina-lang.
the class BIntegerValueTest method testIntegerValueAddition.
@Test(description = "Test long value Addition")
public void testIntegerValueAddition() {
BValue[] returns = BRunUtil.invoke(result, "testIntegerAddition", new BValue[] {});
Assert.assertEquals(returns.length, 1);
Assert.assertSame(returns[0].getClass(), BInteger.class);
BInteger intValue = (BInteger) returns[0];
Assert.assertEquals(intValue.intValue(), 19, "Invalid int value returned.");
}
use of org.ballerinalang.model.values.BInteger in project ballerina by ballerina-lang.
the class BIntegerValueTest method testIntegerTypesValueSubtraction.
@Test(description = "Test integer types value Subtraction")
public void testIntegerTypesValueSubtraction() {
BValue[] returns = BRunUtil.invoke(result, "testIntegerTypesSubtraction", new BValue[] {});
Assert.assertEquals(returns.length, 1);
Assert.assertSame(returns[0].getClass(), BInteger.class);
BInteger intValue = (BInteger) returns[0];
Assert.assertEquals(intValue.intValue(), 0, "Invalid int value returned.");
}
use of org.ballerinalang.model.values.BInteger in project ballerina by ballerina-lang.
the class BIntegerValueTest method testNegativeIntegerValue.
@Test(description = "Test negative long value assignment")
public void testNegativeIntegerValue() {
BValue[] returns = BRunUtil.invoke(result, "testNegativeIntegerValue", new BValue[] {});
Assert.assertEquals(returns.length, 1);
Assert.assertSame(returns[0].getClass(), BInteger.class);
BInteger intValue = (BInteger) returns[0];
Assert.assertEquals(intValue.intValue(), (-10), "Invalid int value returned.");
}
Aggregations