use of org.ballerinalang.model.values.BInteger in project ballerina by ballerina-lang.
the class BIntegerValueTest method testIntegerValue.
@Test(description = "Test long value assignment")
public void testIntegerValue() {
BValue[] returns = BRunUtil.invoke(result, "testIntegerValue", 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 testIntegerValueMultiplication.
@Test(description = "Test long value Multiplication")
public void testIntegerValueMultiplication() {
BValue[] returns = BRunUtil.invoke(result, "testIntegerMultiplication", 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 testHexValue.
@Test(description = "Test long(hex) value assignment")
public void testHexValue() {
BValue[] returns = BRunUtil.invoke(result, "testHexValue", 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 testIntegerParameter.
@Test(description = "Test long value assignment")
public void testIntegerParameter() {
BValue[] args = { new BInteger(20) };
BValue[] returns = BRunUtil.invoke(result, "testIntegerParameter", args);
Assert.assertEquals(returns.length, 1);
Assert.assertSame(returns[0].getClass(), BInteger.class);
BInteger intValue = (BInteger) returns[0];
Assert.assertEquals(intValue.intValue(), 20, "Invalid int value returned.");
}
use of org.ballerinalang.model.values.BInteger in project ballerina by ballerina-lang.
the class BIntegerValueTest method testNegativeOctalValue.
@Test(description = "Test negative long(octal) value assignment")
public void testNegativeOctalValue() {
BValue[] returns = BRunUtil.invoke(result, "testNegativeOctalValue", 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