Search in sources :

Example 1 with BInteger

use of org.ballerinalang.model.values.BInteger in project carbon-apimgt by wso2.

the class WaitTestCase method testCacheDeleteOperation.

@Test
public void testCacheDeleteOperation() {
    // Create arguments to initiate cache
    BValue[] args = { new BInteger(15) };
    // Test ballerina cache create, put and get
    BValue[] returns = BLangFunctions.invokeNew(bLangProgram, "testWait", args);
    // Assert if cache entry is BValue
    Assert.assertTrue(returns[0] instanceof BValue);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BInteger(org.ballerinalang.model.values.BInteger) Test(org.testng.annotations.Test)

Example 2 with BInteger

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

the class Length method execute.

@Override
public void execute(Context context) {
    String param1 = context.getStringArgument(0);
    BInteger intValue = new BInteger(param1.length());
    context.setReturnValues(intValue);
}
Also used : BInteger(org.ballerinalang.model.values.BInteger)

Example 3 with BInteger

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

the class AssertTest method testAssertIntEquals.

@Test
public void testAssertIntEquals() {
    BValue[] args = { new BInteger(3), new BInteger(5) };
    BTestUtils.invoke(compileResult, "testAssertIntEquals", args);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BInteger(org.ballerinalang.model.values.BInteger) Test(org.testng.annotations.Test)

Example 4 with BInteger

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

the class AssertTest method testAssertFloatArrayEquals1.

@Test(expectedExceptions = BLangRuntimeException.class, expectedExceptionsMessageRegExp = ".*expected \\[1.1, 2.2, 3.3\\] but found \\[1.1, 2.2, 3.3, " + "4.4\\].*")
public void testAssertFloatArrayEquals1() {
    BValue[] args = { new BInteger(1) };
    BTestUtils.invoke(compileResult, "testAssertFloatArrayEquals", args);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BInteger(org.ballerinalang.model.values.BInteger) Test(org.testng.annotations.Test)

Example 5 with BInteger

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

the class AssertTest method testAssertStringArrayEquals0.

@Test
public void testAssertStringArrayEquals0() {
    BValue[] args = { new BInteger(0) };
    BTestUtils.invoke(compileResult, "testAssertStringArrayEquals", args);
}
Also used : BValue(org.ballerinalang.model.values.BValue) BInteger(org.ballerinalang.model.values.BInteger) Test(org.testng.annotations.Test)

Aggregations

BInteger (org.ballerinalang.model.values.BInteger)364 BValue (org.ballerinalang.model.values.BValue)324 Test (org.testng.annotations.Test)305 BString (org.ballerinalang.model.values.BString)91 BFloat (org.ballerinalang.model.values.BFloat)55 BStruct (org.ballerinalang.model.values.BStruct)33 BBoolean (org.ballerinalang.model.values.BBoolean)24 BRefValueArray (org.ballerinalang.model.values.BRefValueArray)18 CompileResult (org.ballerinalang.launcher.util.CompileResult)12 BBlob (org.ballerinalang.model.values.BBlob)11 BeforeTest (org.testng.annotations.BeforeTest)11 BIntArray (org.ballerinalang.model.values.BIntArray)9 BMap (org.ballerinalang.model.values.BMap)9 BRefType (org.ballerinalang.model.values.BRefType)8 BStringArray (org.ballerinalang.model.values.BStringArray)8 BallerinaException (org.ballerinalang.util.exceptions.BallerinaException)8 BType (org.ballerinalang.model.types.BType)6 BStructType (org.ballerinalang.model.types.BStructType)4 BJSON (org.ballerinalang.model.values.BJSON)4 UnsupportedFieldTypeException (org.ballerinalang.net.grpc.exception.UnsupportedFieldTypeException)4