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
.Test
;
23 * The class <code>UtilsTest</code> contains tests for the class
27 * @version $Revision: 1.0 $
29 public class UtilsTest
{
32 * Run the UUID makeUUID(byte[]) method test.
35 public void testMakeUUID() {
37 byte[] bytes
= new byte[byteSize
];
38 for (int i
= 0; i
< byteSize
; i
++) {
39 bytes
[i
] = (byte) (i
);
42 UUID result
= Utils
.makeUUID(bytes
);
43 assertNotNull(result
);
47 * Run the UUID makeUUID(byte[]) method test.
50 public void testMakeUUID_2() {
51 byte[] bytes
= new byte[] { (byte) 1, (byte) 1, (byte) 0, (byte) 0,
52 (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 1, (byte) 1,
53 (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
55 UUID result
= Utils
.makeUUID(bytes
);
57 assertNotNull(result
);
58 assertEquals(72339069014638592L, result
.getLeastSignificantBits());
59 assertEquals(72339069014638592L, result
.getMostSignificantBits());
60 assertEquals("01010000-0000-0000-0101-000000000000", result
.toString());
61 assertEquals(0, result
.variant());
62 assertEquals(0, result
.version());
66 * Run the UUID makeUUID(byte[]) method test.
69 public void testMakeUUID_3() {
70 byte[] bytes
= new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0,
71 (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0,
72 (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
74 UUID result
= Utils
.makeUUID(bytes
);
76 assertNotNull(result
);
77 assertEquals(0L, result
.getLeastSignificantBits());
78 assertEquals(0L, result
.getMostSignificantBits());
79 assertEquals("00000000-0000-0000-0000-000000000000", result
.toString());
80 assertEquals(0, result
.variant());
81 assertEquals(0, result
.version());
85 * Run the int unsignedCompare(long,long) method test.
88 public void testUnsignedCompare() {
92 int result
= Utils
.unsignedCompare(a
, b
);
93 assertEquals(0, result
);
This page took 0.031758 seconds and 5 git commands to generate.