Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
TestPlatform01.java
Go to the documentation of this file.
1/**
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2021 Gothel Software e.K.
4 * Copyright (c) 2010 Gothel Software e.K.
5 * Copyright (c) 2010 JogAmp Community.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27package jau.test.sys;
28
29import org.jau.sys.PlatformProps;
30import org.jau.sys.MachineDataInfo;
31import org.jau.sys.RuntimeProps;
32import org.junit.Assert;
33import org.junit.FixMethodOrder;
34import org.junit.Test;
35import org.junit.runners.MethodSorters;
36
37import jau.test.junit.util.JunitTracer;
38
39@FixMethodOrder(MethodSorters.NAME_ASCENDING)
40public class TestPlatform01 extends JunitTracer {
41
42 @Test
43 public void testInfo00() {
44 System.err.println();
45 System.err.print(PlatformProps.NEWLINE);
46 System.err.println("OS name/type: "+PlatformProps.os_name+", "+PlatformProps.OS);
47 System.err.println("OS version: "+PlatformProps.os_version);
48 System.err.println();
49 System.err.println("Arch, CPU: "+PlatformProps.os_arch+", "+PlatformProps.CPU+"/"+PlatformProps.CPU.family);
50 System.err.println("OS/Arch: "+PlatformProps.os_and_arch);
51 System.err.println();
52 System.err.println("Java runtime: "+PlatformProps.JAVA_RUNTIME_NAME);
53 System.err.println("Java version, vm: "+PlatformProps.JAVA_VERSION_NUMBER);
54 System.err.println();
55 System.err.println("MD.ST: "+PlatformProps.MACH_DESC_STAT);
56 System.err.println("MD.RT: "+RuntimeProps.MACH_DESC_RT);
57 System.err.println();
58 System.err.println();
59 }
60
61 @Test
62 public void testPageSize01() {
63 final MachineDataInfo machine = PlatformProps.MACH_DESC_STAT;
64 final int ps = machine.pageSizeInBytes();
65 System.err.println("PageSize: "+ps);
66 Assert.assertTrue("PageSize is 0", 0 < ps );
67
68 final int ps_pages = machine.pageCount(ps);
69 Assert.assertTrue("PageNumber of PageSize is not 1, but "+ps_pages, 1 == ps_pages);
70
71 final int sz0 = ps - 10;
72 final int sz0_pages = machine.pageCount(sz0);
73 Assert.assertTrue("PageNumber of PageSize-10 is not 1, but "+sz0_pages, 1 == sz0_pages);
74
75 final int sz1 = ps + 10;
76 final int sz1_pages = machine.pageCount(sz1);
77 Assert.assertTrue("PageNumber of PageSize+10 is not 2, but "+sz1_pages, 2 == sz1_pages);
78
79 final int ps_psa = machine.pageAlignedSize(ps);
80 Assert.assertTrue("PageAlignedSize of PageSize is not PageSize, but "+ps_psa, ps == ps_psa);
81
82 final int sz0_psa = machine.pageAlignedSize(sz0);
83 Assert.assertTrue("PageAlignedSize of PageSize-10 is not PageSize, but "+sz0_psa, ps == sz0_psa);
84
85 final int sz1_psa = machine.pageAlignedSize(sz1);
86 Assert.assertTrue("PageAlignedSize of PageSize+10 is not 2*PageSize, but "+sz1_psa, ps*2 == sz1_psa);
87 }
88
89 public static void main(final String args[]) {
90 final String tstname = TestPlatform01.class.getName();
91 org.junit.runner.JUnitCore.main(tstname);
92 }
93
94}
static void main(final String args[])