MCPcopy Index your code
hub / github.com/java-native-access/jna / testReadUnion

Method testReadUnion

test/com/sun/jna/UnionTest.java:115–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113 }
114
115 public void testReadUnion() {
116 SizedUnion u = new SizedUnion();
117 final int VALUE = 0x12345678;
118 u.getPointer().setInt(0, VALUE);
119 u.read();
120 assertEquals("int field not read properly", VALUE, u.intField);
121 assertTrue("byte field not read", u.byteField != 0);
122 assertTrue("short field not read", u.shortField != 0);
123 assertTrue("long field not read", u.longField != 0);
124 assertNotNull("Unselected Pointer not read", u.pointer);
125 assertNotNull("Union struct field should be initialized", u.structField);
126 assertNull("Unselected structure should not be read", u.structField.value);
127 assertNull("Unselected String should be null", u.string);
128 assertNull("Unselected WString should be null", u.wstring);
129 }
130
131 public void testWriteTypedUnion() {
132 final int VALUE = 0x12345678;

Callers

nothing calls this directly

Calls 3

getPointerMethod · 0.65
readMethod · 0.65
setIntMethod · 0.45

Tested by

no test coverage detected