1 /*******************************************************************************
2 * Copyright (c) 2013 Ericsson
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Matthew Khouzam - Initial API and implementation
10 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.ctf
.core
.tests
.trace
;
14 import static org
.junit
.Assert
.assertEquals
;
15 import static org
.junit
.Assert
.assertNotNull
;
17 import java
.util
.UUID
;
19 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.Utils
;
20 import org
.junit
.After
;
21 import org
.junit
.Before
;
22 import org
.junit
.Test
;
25 * The class <code>UtilsTest</code> contains tests for the class
29 * @version $Revision: 1.0 $
31 public class UtilsTest
{
37 * the command line arguments
39 public static void main(String
[] args
) {
40 new org
.junit
.runner
.JUnitCore().run(UtilsTest
.class);
44 * Perform pre-test initialization.
48 // add additional set up code here
52 * Perform post-test clean-up.
55 public void tearDown() {
56 // Add additional tear down code here
60 * Run the Utils() constructor test.
63 public void testUtils() {
64 Utils result
= new Utils();
65 assertNotNull(result
);
69 * Run the UUID makeUUID(byte[]) method test.
72 public void testMakeUUID() {
74 byte[] bytes
= new byte[byteSize
];
75 for (int i
= 0; i
< byteSize
; i
++) {
76 bytes
[i
] = (byte) (i
);
79 UUID result
= Utils
.makeUUID(bytes
);
80 assertNotNull(result
);
84 * Run the UUID makeUUID(byte[]) method test.
87 public void testMakeUUID_2() {
88 byte[] bytes
= new byte[] { (byte) 1, (byte) 1, (byte) 0, (byte) 0,
89 (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 1, (byte) 1,
90 (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
92 UUID result
= Utils
.makeUUID(bytes
);
94 assertNotNull(result
);
95 assertEquals(72339069014638592L, result
.getLeastSignificantBits());
96 assertEquals(72339069014638592L, result
.getMostSignificantBits());
97 assertEquals("01010000-0000-0000-0101-000000000000", result
.toString()); //$NON-NLS-1$
98 assertEquals(0, result
.variant());
99 assertEquals(0, result
.version());
103 * Run the UUID makeUUID(byte[]) method test.
106 public void testMakeUUID_3() {
107 byte[] bytes
= new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0,
108 (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0,
109 (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
111 UUID result
= Utils
.makeUUID(bytes
);
113 assertNotNull(result
);
114 assertEquals(0L, result
.getLeastSignificantBits());
115 assertEquals(0L, result
.getMostSignificantBits());
116 assertEquals("00000000-0000-0000-0000-000000000000", result
.toString()); //$NON-NLS-1$
117 assertEquals(0, result
.variant());
118 assertEquals(0, result
.version());
122 * Run the int unsignedCompare(long,long) method test.
125 public void testUnsignedCompare() {
129 int result
= Utils
.unsignedCompare(a
, b
);
130 assertEquals(0, result
);
This page took 0.032481 seconds and 5 git commands to generate.