< prev index next >

test/jdk/tools/jextract/test8244412/LibTest8244412Test.java

Print this page

 6  * under the terms of the GNU General Public License version 2 only, as
 7  * published by the Free Software Foundation.
 8  *
 9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 
25 import jdk.incubator.foreign.MemoryAddress;
26 import jdk.incubator.foreign.NativeAllocationScope;
27 
28 import org.testng.annotations.Test;
29 import test.jextract.test8244412.Clong_long;

30 import static org.testng.Assert.assertEquals;
31 import static org.testng.Assert.assertTrue;
32 import static test.jextract.test8244412.test8244412_h.*;
33 
34 /*
35  * @test
36  * @library ..
37  * @modules jdk.incubator.jextract
38  * @bug 8244412
39  * @summary jextract should generate static utils class for primitive typedefs
40  * @run driver JtregJextract -t test.jextract.test8244412 -- test8244412.h
41  * @run testng/othervm -Dforeign.restricted=permit LibTest8244412Test
42  */
43 public class LibTest8244412Test {
44     @Test
45     public void test() {
46         try (var scope = NativeAllocationScope.unboundedScope()) {
47             var addr = Cmysize_t.allocate(0L, scope);
48             assertEquals(Cmysize_t.get(addr), 0L);
49             Cmysize_t.set(addr, 13455566L);
50             assertEquals(Cmysize_t.get(addr), 13455566L);
51             assertTrue(Cmysize_t.sizeof() == Clong_long.sizeof());
52         }
53     }
54 }

 6  * under the terms of the GNU General Public License version 2 only, as
 7  * published by the Free Software Foundation.
 8  *
 9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 
25 import jdk.incubator.foreign.MemoryAddress;

26 
27 import org.testng.annotations.Test;
28 import test.jextract.test8244412.Clong_long;
29 import test.jextract.test8244412.CScope;
30 import static org.testng.Assert.assertEquals;
31 import static org.testng.Assert.assertTrue;
32 import static test.jextract.test8244412.test8244412_h.*;
33 
34 /*
35  * @test
36  * @library ..
37  * @modules jdk.incubator.jextract
38  * @bug 8244412
39  * @summary jextract should generate static utils class for primitive typedefs
40  * @run driver JtregJextract -t test.jextract.test8244412 -- test8244412.h
41  * @run testng/othervm -Dforeign.restricted=permit LibTest8244412Test
42  */
43 public class LibTest8244412Test {
44     @Test
45     public void test() {
46         try (var scope = new CScope()) {
47             var addr = Cmysize_t.allocate(0L, scope);
48             assertEquals(Cmysize_t.get(addr), 0L);
49             Cmysize_t.set(addr, 13455566L);
50             assertEquals(Cmysize_t.get(addr), 13455566L);
51             assertTrue(Cmysize_t.sizeof() == Clong_long.sizeof());
52         }
53     }
54 }
< prev index next >