GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
TestPlatform01.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.common.util;
30
31import org.junit.Assert;
32import org.junit.Test;
33
34import com.jogamp.common.os.MachineDataInfo;
35import com.jogamp.common.os.Platform;
36import com.jogamp.junit.util.SingletonJunitCase;
37
38import org.junit.FixMethodOrder;
39import org.junit.runners.MethodSorters;
40
41@FixMethodOrder(MethodSorters.NAME_ASCENDING)
42public class TestPlatform01 extends SingletonJunitCase {
43
44 @Test
45 public void testInfo00() {
46 System.err.println();
47 System.err.print(Platform.getNewline());
48 System.err.println("OS name/type: "+Platform.getOSName()+", "+Platform.getOSType());
49 System.err.println("OS version: "+Platform.getOSVersion()+", "+Platform.getOSVersionNumber());
50 System.err.println();
51 System.err.println("Arch, CPU: "+Platform.getArchName()+", "+Platform.getCPUType()+"/"+Platform.getCPUFamily());
52 System.err.println("OS/Arch: "+Platform.getOSAndArch());
53 System.err.println();
54 System.err.println("Java runtime: "+Platform.getJavaRuntimeName());
55 System.err.println("Java vendor[name/url]: "+Platform.getJavaVendor()+"/"+Platform.getJavaVendorURL());
56 System.err.println("Java version, vm: "+Platform.getJavaVersion()+", "+Platform.getJavaVMName());
57 System.err.println();
58 System.err.println("MD: "+Platform.getMachineDataInfo());
59 System.err.println();
60 System.err.println();
61 }
62
63 @Test
64 public void testPageSize01() {
66 final int ps = machine.pageSizeInBytes();
67 System.err.println("PageSize: "+ps);
68 Assert.assertTrue("PageSize is 0", 0 < ps );
69
70 final int ps_pages = machine.pageCount(ps);
71 Assert.assertTrue("PageNumber of PageSize is not 1, but "+ps_pages, 1 == ps_pages);
72
73 final int sz0 = ps - 10;
74 final int sz0_pages = machine.pageCount(sz0);
75 Assert.assertTrue("PageNumber of PageSize-10 is not 1, but "+sz0_pages, 1 == sz0_pages);
76
77 final int sz1 = ps + 10;
78 final int sz1_pages = machine.pageCount(sz1);
79 Assert.assertTrue("PageNumber of PageSize+10 is not 2, but "+sz1_pages, 2 == sz1_pages);
80
81 final int ps_psa = machine.pageAlignedSize(ps);
82 Assert.assertTrue("PageAlignedSize of PageSize is not PageSize, but "+ps_psa, ps == ps_psa);
83
84 final int sz0_psa = machine.pageAlignedSize(sz0);
85 Assert.assertTrue("PageAlignedSize of PageSize-10 is not PageSize, but "+sz0_psa, ps == sz0_psa);
86
87 final int sz1_psa = machine.pageAlignedSize(sz1);
88 Assert.assertTrue("PageAlignedSize of PageSize+10 is not 2*PageSize, but "+sz1_psa, ps*2 == sz1_psa);
89 }
90
91 public static void main(final String args[]) {
92 final String tstname = TestPlatform01.class.getName();
93 org.junit.runner.JUnitCore.main(tstname);
94 }
95
96}
Machine data description for alignment and size onle, see com.jogamp.gluegen.
Utility class for querying platform specific properties.
Definition: Platform.java:58
static VersionNumber getOSVersionNumber()
Returns the OS version number.
Definition: Platform.java:386
static String getOSAndArch()
Returns the GlueGen common name for the currently running OSType and CPUType as implemented in the bu...
Definition: Platform.java:454
static String getOSVersion()
Returns the OS version.
Definition: Platform.java:379
static String getJavaVersion()
Returns the JAVA version.
Definition: Platform.java:489
static String getJavaVMName()
Returns the JAVA VM name.
Definition: Platform.java:468
static String getJavaVendorURL()
Returns the JAVA vendor url.
Definition: Platform.java:482
static OSType getOSType()
Returns the OS type.
Definition: Platform.java:401
static MachineDataInfo getMachineDataInfo()
Returns the MachineDataInfo of the running machine.
Definition: Platform.java:510
static String getJavaRuntimeName()
Returns the JAVA runtime name.
Definition: Platform.java:475
static String getOSName()
Returns the OS name.
Definition: Platform.java:372
static String getArchName()
Returns the CPU architecture String.
Definition: Platform.java:393
static String getJavaVendor()
Returns the JAVA vendor.
Definition: Platform.java:461
static CPUFamily getCPUFamily()
Returns the CPU family.
Definition: Platform.java:408
static String getNewline()
Returns the platform's line separator.
Definition: Platform.java:503
static CPUType getCPUType()
Returns the CPU architecture type.
Definition: Platform.java:415
static void main(final String args[])