summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-07-17 16:34:39 +0200
committerSven Gothel <[email protected]>2011-07-17 16:34:39 +0200
commitf733203dfbd034a6b1aa3eb2cd616437c982c435 (patch)
tree4ace71d4b129870b02f962b714c9dce9f83bc294 /src/junit/com/jogamp/common/util
parentad3dc39ccfddb007c3e91acf454f804573969419 (diff)
GlueGen proper size / alignment of primitive and compound types usage [1/2] - Preparation.
Currently GlueGen fails for type long (size) and some alignments (see package.html). - The size and alignment values shall be queried at runtime. - Compound alignment needs to follow the described natural alignment (also @runtime). - - Build - add Linux Arm7 (EABI) - junit test - added compound/struct tests, pointing out the shortcomings of current impl. - package.html - Added alignment documentation - remove intptr.cfg - add GluGen types int8_t, int16_t, uint8_t, uint16_t - move MachineDescription* into runtime - Platform - has runtime MachineDescription - moved size, .. to MachineDescription - use enums for OSType, CPUArch and CPUType defined by os.name/os.arch, triggering exception if os/arch is not supported. This avoids Java String comparison and conscious os/arch detection. - MachineDescription: - compile time instances MachineDescription32Bits, MachineDescription64Bits - runtime queried instance MachineDescriptionRuntime - correct size, alignment, page size, ..
Diffstat (limited to 'src/junit/com/jogamp/common/util')
-rw-r--r--src/junit/com/jogamp/common/util/TestIOUtil01.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestPlatform01.java16
2 files changed, 12 insertions, 8 deletions
diff --git a/src/junit/com/jogamp/common/util/TestIOUtil01.java b/src/junit/com/jogamp/common/util/TestIOUtil01.java
index ad95213..fd95652 100644
--- a/src/junit/com/jogamp/common/util/TestIOUtil01.java
+++ b/src/junit/com/jogamp/common/util/TestIOUtil01.java
@@ -44,11 +44,13 @@ import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import com.jogamp.common.os.MachineDescription;
import com.jogamp.common.os.Platform;
public class TestIOUtil01 {
- static final int tsz = Platform.getPageSize() + Platform.getPageSize() / 2 ;
+ static final MachineDescription machine = Platform.getMachineDescription();
+ static final int tsz = machine.pageSizeInBytes() + machine.pageSizeInBytes() / 2 ;
static final byte[] orig = new byte[tsz];
static final String tfilename = "./test.bin" ;
diff --git a/src/junit/com/jogamp/common/util/TestPlatform01.java b/src/junit/com/jogamp/common/util/TestPlatform01.java
index 544418a..1266c45 100644
--- a/src/junit/com/jogamp/common/util/TestPlatform01.java
+++ b/src/junit/com/jogamp/common/util/TestPlatform01.java
@@ -31,34 +31,36 @@ package com.jogamp.common.util;
import org.junit.Assert;
import org.junit.Test;
+import com.jogamp.common.os.MachineDescription;
import com.jogamp.common.os.Platform;
public class TestPlatform01 {
@Test
public void testPageSize01() {
- final int ps = Platform.getPageSize();
+ final MachineDescription machine = Platform.getMachineDescription();
+ final int ps = machine.pageSizeInBytes();
System.err.println("PageSize: "+ps);
Assert.assertTrue("PageSize is 0", 0 < ps );
- final int ps_pages = Platform.getPageNumber(ps);
+ final int ps_pages = machine.pageCount(ps);
Assert.assertTrue("PageNumber of PageSize is not 1, but "+ps_pages, 1 == ps_pages);
final int sz0 = ps - 10;
- final int sz0_pages = Platform.getPageNumber(sz0);
+ final int sz0_pages = machine.pageCount(sz0);
Assert.assertTrue("PageNumber of PageSize-10 is not 1, but "+sz0_pages, 1 == sz0_pages);
final int sz1 = ps + 10;
- final int sz1_pages = Platform.getPageNumber(sz1);
+ final int sz1_pages = machine.pageCount(sz1);
Assert.assertTrue("PageNumber of PageSize+10 is not 2, but "+sz1_pages, 2 == sz1_pages);
- final int ps_psa = Platform.getPageAlignedSize(ps);
+ final int ps_psa = machine.pageAlignedSize(ps);
Assert.assertTrue("PageAlignedSize of PageSize is not PageSize, but "+ps_psa, ps == ps_psa);
- final int sz0_psa = Platform.getPageAlignedSize(sz0);
+ final int sz0_psa = machine.pageAlignedSize(sz0);
Assert.assertTrue("PageAlignedSize of PageSize-10 is not PageSize, but "+sz0_psa, ps == sz0_psa);
- final int sz1_psa = Platform.getPageAlignedSize(sz1);
+ final int sz1_psa = machine.pageAlignedSize(sz1);
Assert.assertTrue("PageAlignedSize of PageSize+10 is not 2*PageSize, but "+sz1_psa, ps*2 == sz1_psa);
}