GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
Test1p2ProcAddressEmitter.java
Go to the documentation of this file.
1/**
2 * Copyright 2010 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28
29package com.jogamp.gluegen.test.junit.generation;
30
31import java.io.IOException;
32
33import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest1p1Impl;
34import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest1p2Impl;
35import com.jogamp.common.os.NativeLibrary;
36
37import org.junit.AfterClass;
38import org.junit.Assert;
39import org.junit.BeforeClass;
40import org.junit.Test;
41
42/**
43 * @author Michael Bien
44 * @author Sven Gothel
45 */
46import org.junit.FixMethodOrder;
47import org.junit.runners.MethodSorters;
48
49@FixMethodOrder(MethodSorters.NAME_ASCENDING)
51
52 static NativeLibrary dynamicLookupHelper;
53
54 /**
55 * Verifies loading of the new library.
56 */
57 @BeforeClass
58 public static void chapter__TestLoadLibrary() throws Exception {
60 dynamicLookupHelper = NativeLibrary.open("test1", false, false, Test1p2ProcAddressEmitter.class.getClassLoader(), true, "testXID");
61 Assert.assertNotNull("NativeLibrary.open(test1) failed", dynamicLookupHelper);
62 System.err.println("Loaded: "+dynamicLookupHelper);
63
64 Bindingtest1p2Impl.resetProcAddressTable(dynamicLookupHelper);
65 }
66
67 /**
68 * Verifies the existence and creation of the generated class.
69 */
70 @Test
71 public void chapter00TestClassExist() throws Exception {
72 testClassExist("test1p2");
73 }
74
75 /**
76 * Verifies if all generated method signatures are completed,
77 * ie a compilation only coverage test without functional tests.
78 */
79 public void chapter__TestCoverageSignature() throws Exception {
80 chapter__TestCoverageSignature(new Bindingtest1p2Impl());
81 }
82
83 /**
84 * Verifies if all generated static constant values are completed,
85 * and whether their value is as expected!
86 * <p>
87 * Covers all enumerates and defines.
88 * </p>
89 */
90 @Test
91 public void chapter01TestStaticConstants() throws Exception {
92 chapter01TestStaticConstants(new Bindingtest1p2Impl());
93 }
94
95 /**
96 * Verifies if all methods / signatures are properly generated,
97 * can be invoked and functions.
98 * This is a compilation (coverage) and runtime time (semantic) test.
99 * This covers indirect primitive arrays and direct NIO buffers.
100 */
101 @Test
103 chapter03TestCoverageFunctionalityNIOAndPrimitiveArray(new Bindingtest1p2Impl(), true);
104 }
105
106 /**
107 * Verifies if all methods / signatures are properly generated,
108 * can be invoked and functions.
109 * This is a compilation (coverage) and runtime time (semantic) test.
110 * This covers indirect primitive arrays and indirect NIO buffers (nio using arrays).
111 */
112 @Test
114 chapter03TestCoverageFunctionalityNIOAndPrimitiveArray(new Bindingtest1p2Impl(), false);
115 }
116
117 /**
118 * This covers direct / indirect pointer buffers
119 */
120 @Test
121 public void chapter04TestPointerBuffer() throws Exception {
122 this.chapter04TestPointerBuffer(new Bindingtest1p2Impl());
123 }
124
125 /**
126 * This covers indirect primitive arrays and indirect NIO buffers.
127 */
128 @Test
129 public void chapter05TestSomeFunctionsAllIndirect() throws Exception {
130 chapter05TestSomeFunctionsAllIndirect(new Bindingtest1p2Impl());
131 }
132
133 /**
134 * This covers compounds (structs) data alignment
135 */
136 @Test
137 public void chapter09TestCompoundAlignment() throws Exception {
138 chapter09TestCompoundAlignment(new Bindingtest1p2Impl());
139 }
140
141 /**
142 * This covers compounds (structs) call-by-reference
143 */
144 @Test
145 public void chapter10TestCompoundCallByReference() throws Exception {
146 chapter10TestCompoundCallByReference(new Bindingtest1p2Impl());
147 }
148
149 /**
150 * This covers compounds (structs) call-by-value
151 */
152 @Test
153 public void chapter11TestCompoundCallByValue() throws Exception {
154 chapter11TestCompoundCallByValue(new Bindingtest1p2Impl());
155 }
156
157 /**
158 * Test compound access read-write
159 */
160 @Test
161 public void chapter12TestTKField() throws Exception {
162 chapter12TestTKField(new Bindingtest1p2Impl());
163 }
164
165 /**
166 * Test compound access read-only
167 */
168 @Test
169 public void chapter13TestTKFieldImmutable() throws Exception {
170 chapter13TestTKFieldImmutable(new Bindingtest1p2Impl());
171 }
172
173 @Test
174 public void chapter15TestTKMixed() throws Exception {
175 chapter14TestTKMixed(new Bindingtest1p2Impl());
176 }
177
178 /**
179 * Test Custom JNI Code invocation
180 */
181 @Test
182 public void chapter14TestCustomJNICode() throws Exception {
183 chapter15TestCustomJNICode(new Bindingtest1p2Impl());
184 }
185
186 /**
187 * Verifies unloading of the new library.
188 */
189 @AfterClass
190 public static void chapter0XTestUnloadLibrary() throws Exception {
191 Assert.assertNotNull(dynamicLookupHelper);
192 dynamicLookupHelper.close();
193 dynamicLookupHelper = null;
194 }
195
196 public static void main(final String args[]) throws IOException {
197 final String tstname = Test1p2ProcAddressEmitter.class.getName();
198 org.junit.runner.JUnitCore.main(tstname);
199 }
200}
Provides low-level, relatively platform-independent access to shared ("native") libraries.
final void close()
Closes this native library.
static final NativeLibrary open(final String libName, final boolean searchOSSystemPath, final boolean searchSystemPathFirst, final ClassLoader loader, final boolean global)
Opens the given native library, assuming it has the same base name on all platforms.
static void chapter__TestLoadLibrary()
Verifies loading of the new library.
void chapter__TestCoverageSignature()
Verifies if all generated method signatures are completed, ie a compilation only coverage test withou...
void chapter10TestCompoundCallByReference()
This covers compounds (structs) call-by-reference.
void chapter09TestCompoundAlignment()
This covers compounds (structs) data alignment.
void chapter05TestSomeFunctionsAllIndirect()
This covers indirect primitive arrays and indirect NIO buffers.
void chapter04TestPointerBuffer()
This covers direct / indirect pointer buffers.
void chapter00TestClassExist()
Verifies the existence and creation of the generated class.
static void chapter0XTestUnloadLibrary()
Verifies unloading of the new library.
void chapter01TestStaticConstants()
Verifies if all generated static constant values are completed, and whether their value is as expecte...
void chapter11TestCompoundCallByValue()
This covers compounds (structs) call-by-value.
void chapter03bTestCoverageFunctionalityIndirectNIOAndPrimitiveArray()
Verifies if all methods / signatures are properly generated, can be invoked and functions.
void chapter03aTestCoverageFunctionalityDirectNIOAndPrimitiveArray()
Verifies if all methods / signatures are properly generated, can be invoked and functions.