Search in sources :

Example 6 with MarshalSite

use of org.robovm.compiler.MarshalerLookup.MarshalSite in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodClassMatchArray.

@Test
public void testFindMarshalerMethodClassMatchArray() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod method = toSootClass(Foo4.class).getMethodByName("foo6");
    assertEquals(toSootClass(M2.class).getMethodByName("stringArrayToObject"), lookup.findMarshalerMethod(new MarshalSite(method)).getMethod());
    assertEquals(toSootClass(M2.class).getMethodByName("stringArrayToNative"), lookup.findMarshalerMethod(new MarshalSite(method, 0)).getMethod());
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) SootMethod(soot.SootMethod) Test(org.junit.Test)

Example 7 with MarshalSite

use of org.robovm.compiler.MarshalerLookup.MarshalSite in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodUnsuccessfulSearchNoMarshalers.

@Test
public void testFindMarshalerMethodUnsuccessfulSearchNoMarshalers() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod method = toSootClass(Foo1.class).getMethodByName("foo");
    try {
        lookup.findMarshalerMethod(new MarshalSite(method));
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
    }
    try {
        lookup.findMarshalerMethod(new MarshalSite(method, 0));
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
    }
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) SootMethod(soot.SootMethod) Test(org.junit.Test)

Example 8 with MarshalSite

use of org.robovm.compiler.MarshalerLookup.MarshalSite in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodClassMatchPointer.

@Test
public void testFindMarshalerMethodClassMatchPointer() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod method = toSootClass(Foo4.class).getMethodByName("foo1");
    assertEquals(toSootClass(M2.class).getMethodByName("stringToObject"), lookup.findMarshalerMethod(new MarshalSite(method)).getMethod());
    assertEquals(toSootClass(M2.class).getMethodByName("stringToNative"), lookup.findMarshalerMethod(new MarshalSite(method, 0)).getMethod());
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) SootMethod(soot.SootMethod) Test(org.junit.Test)

Example 9 with MarshalSite

use of org.robovm.compiler.MarshalerLookup.MarshalSite in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerMethodUnsuccessfulSearchUnsupportedCallTypeStructMember.

@Test
public void testFindMarshalerMethodUnsuccessfulSearchUnsupportedCallTypeStructMember() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod getter = toSootClass(TestStruct.class).getMethodByName("getV1");
    SootMethod setter = toSootClass(TestStruct.class).getMethodByName("setV1");
    try {
        lookup.findMarshalerMethod(new MarshalSite(getter)).getMethod();
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
    }
    try {
        lookup.findMarshalerMethod(new MarshalSite(setter, 0)).getMethod();
        fail("IllegalArgumentException expected");
    } catch (IllegalArgumentException e) {
    }
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) SootMethod(soot.SootMethod) Test(org.junit.Test)

Example 10 with MarshalSite

use of org.robovm.compiler.MarshalerLookup.MarshalSite in project robovm by robovm.

the class MarshalerLookupTest method testFindMarshalerStructMemberPrimitiveArray3D.

@Test
public void testFindMarshalerStructMemberPrimitiveArray3D() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod getter = toSootClass(TestStruct.class).getMethodByName("getV4");
    SootMethod setter = toSootClass(TestStruct.class).getMethodByName("setV4");
    assertEquals(toSootClass(M2.class).getMethodByName("byteArray3DToObject"), lookup.findMarshalerMethod(new MarshalSite(getter)).getMethod());
    assertEquals(toSootClass(M2.class).getMethodByName("byteArray3DToNative"), lookup.findMarshalerMethod(new MarshalSite(setter, 0)).getMethod());
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) SootMethod(soot.SootMethod) Test(org.junit.Test)

Aggregations

MarshalSite (org.robovm.compiler.MarshalerLookup.MarshalSite)27 SootMethod (soot.SootMethod)21 Test (org.junit.Test)18 MarshalerMethod (org.robovm.compiler.MarshalerLookup.MarshalerMethod)9 StructureType (org.robovm.compiler.llvm.StructureType)6 ArrayMarshalerMethod (org.robovm.compiler.MarshalerLookup.ArrayMarshalerMethod)5 ValueMarshalerMethod (org.robovm.compiler.MarshalerLookup.ValueMarshalerMethod)5 PrimitiveType (org.robovm.compiler.llvm.PrimitiveType)5 PointerMarshalerMethod (org.robovm.compiler.MarshalerLookup.PointerMarshalerMethod)4 IntegerConstant (org.robovm.compiler.llvm.IntegerConstant)4 PointerType (org.robovm.compiler.llvm.PointerType)4 ArrayType (org.robovm.compiler.llvm.ArrayType)3 FunctionType (org.robovm.compiler.llvm.FunctionType)3 Type (org.robovm.compiler.llvm.Type)3 Value (org.robovm.compiler.llvm.Value)3 PrimType (soot.PrimType)3 ArrayList (java.util.ArrayList)2 BasicBlockRef (org.robovm.compiler.llvm.BasicBlockRef)2 Bitcast (org.robovm.compiler.llvm.Bitcast)2 ConstantBitcast (org.robovm.compiler.llvm.ConstantBitcast)2