blob: e45e8a083cb3dfb6211ffd5d716876a52cf2bea1 [file] [log] [blame]
Yotam Harcholf3f11152013-09-05 16:47:16 -07001package org.projectfloodlight.openflow.types;
2
3import static org.junit.Assert.assertEquals;
4
5import java.math.BigInteger;
6
7import org.junit.Test;
8
9public class U64Test {
10
11 @Test
12 public void testPositiveRaws() {
13 for(long positive: new long[] { 0, 1, 100, Long.MAX_VALUE }) {
14 assertEquals(positive, U64.ofRaw(positive).getValue());
15 assertEquals(BigInteger.valueOf(positive), U64.ofRaw(positive).getBigInteger());
16 }
17 }
18
19 @Test
20 public void testNegativeRaws() {
21 long minus_1 = 0xFFffFFffFFffFFffL;
22 assertEquals(minus_1, U64.ofRaw(minus_1).getValue());
23 assertEquals(new BigInteger("FFffFFffFFffFFff", 16), U64.ofRaw(minus_1).getBigInteger());
24 assertEquals(new BigInteger("18446744073709551615"), U64.ofRaw(minus_1).getBigInteger());
25 }
26}