Initial opendaylight infrastructure commit!!
[controller.git] / third-party / openflowj / src / test / java / org / openflow / util / U16Test.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 junit.framework.TestCase;
13
14 public class U16Test extends TestCase {
15   /**
16    * Tests that we correctly translate unsigned values in and out of a short
17    * @throws Exception
18    */
19   public void test() throws Exception {
20       int val = 0xffff;
21       TestCase.assertEquals((short)-1, U16.t(val));
22       TestCase.assertEquals((short)32767, U16.t(0x7fff));
23       TestCase.assertEquals(val, U16.f((short)-1));
24   }
25 }