blob: 16d3d3e16dc894e88d24ef30dcf23cc753c2af1e [file] [log] [blame]
Andreas Wundsam16b9d872013-07-18 19:58:10 -07001package org.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.of(positive).getValue());
15 assertEquals(BigInteger.valueOf(positive), U64.of(positive).getBigInteger());
16 }
17 }
18
19 @Test
20 public void testNegativeRaws() {
21 long minus_1 = 0xFFffFFffFFffFFffL;
22 assertEquals(minus_1, U64.of(minus_1).getValue());
23 assertEquals(new BigInteger("FFffFFffFFffFFff", 16), U64.of(minus_1).getBigInteger());
24 assertEquals(new BigInteger("18446744073709551615"), U64.of(minus_1).getBigInteger());
25 }
26}