Example #1
0
 public void testOptionsInferenceFromTypeMapperField() {
   assertEquals(
       "Wrong type mapper found for interface which provides TYPE_MAPPER",
       TestInterfaceWithTypeMapper.TEST_MAPPER,
       Native.getTypeMapper(TestInterfaceWithTypeMapper.class));
   assertEquals(
       "Wrong type mapper found for structure from interface which provides TYPE_MAPPER",
       TestInterfaceWithTypeMapper.TEST_MAPPER,
       Native.getTypeMapper(TestInterfaceWithTypeMapper.TestStructure.class));
 }
Example #2
0
 public void testOptionsInferenceFromOptionsField() {
   Class[] classes = {
     TestInterfaceWithOptions.class, TestInterfaceWithOptions.TestStructure.class
   };
   for (int i = 0; i < classes.length; i++) {
     assertEquals(
         "Wrong type mapper found",
         TestInterfaceWithOptions.TEST_MAPPER,
         Native.getTypeMapper(classes[i]));
     assertEquals(
         "Wrong alignment found",
         TestInterfaceWithOptions.TEST_ALIGNMENT,
         Native.getStructureAlignment(classes[i]));
     assertEquals(
         "Wrong encoding found",
         TestInterfaceWithOptions.TEST_ENCODING,
         Native.getStringEncoding(classes[i]));
   }
 }
Example #3
0
 public void testOptionsInferenceFromInstanceField() {
   Class[] classes = {
     TestInterfaceWithInstance.class, TestInterfaceWithInstance.TestStructure.class
   };
   String[] desc = {"interface", "structure from interface"};
   for (int i = 0; i < classes.length; i++) {
     assertEquals(
         "Wrong type mapper found for " + desc[i],
         TestInterfaceWithInstance.TEST_MAPPER,
         Native.getTypeMapper(classes[i]));
     assertEquals(
         "Wrong alignment found for " + desc[i],
         TestInterfaceWithInstance.TEST_ALIGNMENT,
         Native.getStructureAlignment(classes[i]));
     assertEquals(
         "Wrong string encoding found for " + desc[i],
         TestInterfaceWithInstance.TEST_ENCODING,
         Native.getStringEncoding(classes[i]));
   }
 }
Example #4
0
 public void testGetTypeMapperFromCallbackInterface() throws Exception {
   assertEquals(
       "Wrong type mapper for callback class",
       TestCallback.TYPE_MAPPER,
       Native.getTypeMapper(TestCallback.class));
 }