Esempio n. 1
0
 public void testOptionsInferenceFromEncodingField() {
   assertEquals(
       "Wrong encoding found for interface which provides STRING_ENCODING",
       TestInterfaceWithEncoding.STRING_ENCODING,
       Native.getStringEncoding(TestInterfaceWithEncoding.class));
   assertEquals(
       "Wrong encoding found for structure from interface which provides STRING_ENCODING",
       TestInterfaceWithEncoding.STRING_ENCODING,
       Native.getStringEncoding(TestInterfaceWithEncoding.TestStructure.class));
 }
Esempio n. 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]));
   }
 }
Esempio n. 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]));
   }
 }