29package com.jogamp.common.util;
31import org.junit.Assert;
34import com.jogamp.common.os.MachineDataInfo;
35import com.jogamp.common.os.Platform;
36import com.jogamp.junit.util.SingletonJunitCase;
38import org.junit.FixMethodOrder;
39import org.junit.runners.MethodSorters;
41@FixMethodOrder(MethodSorters.NAME_ASCENDING)
66 final int ps = machine.pageSizeInBytes();
67 System.err.println(
"PageSize: "+ps);
68 Assert.assertTrue(
"PageSize is 0", 0 < ps );
70 final int ps_pages = machine.
pageCount(ps);
71 Assert.assertTrue(
"PageNumber of PageSize is not 1, but "+ps_pages, 1 == ps_pages);
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);
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);
82 Assert.assertTrue(
"PageAlignedSize of PageSize is not PageSize, but "+ps_psa, ps == ps_psa);
85 Assert.assertTrue(
"PageAlignedSize of PageSize-10 is not PageSize, but "+sz0_psa, ps == sz0_psa);
88 Assert.assertTrue(
"PageAlignedSize of PageSize+10 is not 2*PageSize, but "+sz1_psa, ps*2 == sz1_psa);
91 public static void main(
final String args[]) {
93 org.junit.runner.JUnitCore.
main(tstname);
Machine data description for alignment and size onle, see com.jogamp.gluegen.
int pageAlignedSize(final int size)
int pageCount(final int size)