< prev index next > test/jdk/tools/jextract/test8246341/LibTest8246341Test.java
Print this page
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import jdk.incubator.foreign.MemoryAddress;
- import jdk.incubator.foreign.NativeAllocationScope;
import org.testng.annotations.Test;
import test.jextract.test8246341.*;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static test.jextract.test8246341.test8246341_h.*;
assertTrue(callbackCalled[0]);
}
@Test
public void testPointerAllocate() {
! try (var scope = NativeAllocationScope.boundedScope(Cpointer.sizeof())) {
var addr = Cpointer.allocate(MemoryAddress.NULL, scope);
fillin(addr);
assertEquals(Cstring.toJavaString(Cpointer.get(addr)), "hello world");
}
assertTrue(callbackCalled[0]);
}
@Test
public void testPointerAllocate() {
! try (var scope = new CScope(Cpointer.sizeof())) {
var addr = Cpointer.allocate(MemoryAddress.NULL, scope);
fillin(addr);
assertEquals(Cstring.toJavaString(Cpointer.get(addr)), "hello world");
}
< prev index next >