c9e815c9123edf60e41999f7b3114149b3be3e95
[controller.git] / third-party / openflowj / src / test / java / org / openflow / util / U64Test.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.openflow.util;
11
12 import java.math.BigInteger;
13
14 import junit.framework.TestCase;
15
16 public class U64Test extends TestCase {
17   /**
18    * Tests that we correctly translate unsigned values in and out of a long
19    * @throws Exception
20    */
21   public void test() throws Exception {
22       BigInteger val = new BigInteger("ffffffffffffffff", 16);
23       TestCase.assertEquals(-1, U64.t(val));
24       TestCase.assertEquals(val, U64.f(-1));
25   }
26 }