97014f91c2fb649b9254fe6c84769c74babdd1c3
[openflowjava.git] / third-party / openflow-codec / src / test / java / org / openflow / codec / util / U16Test.java
1 package org.openflow.codec.util;
2
3 import org.openflow.codec.util.U16;
4
5 import junit.framework.TestCase;
6
7 public class U16Test extends TestCase {
8     /**
9      * Tests that we correctly translate unsigned values in and out of a short
10      *
11      * @throws Exception
12      */
13     public void test() throws Exception {
14         int val = 0xffff;
15         TestCase.assertEquals((short) -1, U16.t(val));
16         TestCase.assertEquals((short) 32767, U16.t(0x7fff));
17         TestCase.assertEquals(val, U16.f((short) -1));
18     }
19 }