Search in sources :

Example 11 with BValue

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

the class HasKey method execute.

public void execute(Context ctx) {
    BMap<String, BValue> map = (BMap<String, BValue>) ctx.getRefArgument(0);
    String key = ctx.getStringArgument(0);
    ctx.setReturnValues(new BBoolean(map.hasKey(key)));
}
Also used : BMap(org.ballerinalang.model.values.BMap) BValue(org.ballerinalang.model.values.BValue) BBoolean(org.ballerinalang.model.values.BBoolean)

Example 12 with BValue

use of org.ballerinalang.model.values.BValue 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 13 with BValue

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

the class AssertTest method testAssertTrue.

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

Example 14 with BValue

use of org.ballerinalang.model.values.BValue 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 15 with BValue

use of org.ballerinalang.model.values.BValue 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

BValue (org.ballerinalang.model.values.BValue)1043 Test (org.testng.annotations.Test)923 BString (org.ballerinalang.model.values.BString)437 BInteger (org.ballerinalang.model.values.BInteger)323 BStruct (org.ballerinalang.model.values.BStruct)188 BFloat (org.ballerinalang.model.values.BFloat)118 BJSON (org.ballerinalang.model.values.BJSON)112 BBoolean (org.ballerinalang.model.values.BBoolean)79 CompileResult (org.ballerinalang.launcher.util.CompileResult)60 BRefValueArray (org.ballerinalang.model.values.BRefValueArray)45 BMap (org.ballerinalang.model.values.BMap)43 BXMLItem (org.ballerinalang.model.values.BXMLItem)42 BXML (org.ballerinalang.model.values.BXML)40 BStringArray (org.ballerinalang.model.values.BStringArray)30 BIntArray (org.ballerinalang.model.values.BIntArray)25 BBlob (org.ballerinalang.model.values.BBlob)23 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)19 BeforeTest (org.testng.annotations.BeforeTest)19 HTTPCarbonMessage (org.wso2.transport.http.netty.message.HTTPCarbonMessage)19 BallerinaException (org.ballerinalang.util.exceptions.BallerinaException)16