Search in sources :

Example 11 with MarshalSite

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

the class MarshalerLookupTest method testFindMarshalerMethodInterfaceMatchPointer.

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

Example 12 with MarshalSite

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

the class MarshalerLookupTest method testFindMarshalerStructMemberPrimitiveArray2D.

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

Example 13 with MarshalSite

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

the class MarshalerLookupTest method testFindMarshalerMethodSuperclassMatchValue.

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

Example 14 with MarshalSite

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

the class MarshalerLookupTest method testFindMarshalerMethodInterfaceDirectMatchPointer.

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

Example 15 with MarshalSite

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

the class MarshalerLookupTest method testFindMarshalerMethodUnsuccessfulSearchNoMatchingMarshaler.

@Test
public void testFindMarshalerMethodUnsuccessfulSearchNoMatchingMarshaler() {
    MarshalerLookup lookup = new MarshalerLookup(config).searchBuiltins(false);
    SootMethod method = toSootClass(Foo2.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)

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