/*
   * Int tests
   */
  @Test
  public void testGetAndSetInt() throws Exception {
    // cant test for numbers outside range as putint accepts int and
    // hence java doesnt allow values outside range -2147483648 to 2147483647 to be set to
    // valriables
    // hence no test case for assertFalse for numbers outside -2147483648 to 2147483647
    WrappedByteBuffer buf = new WrappedByteBuffer();
    int b1 = -2147483648;
    int b2 = 2147483647;
    int b3 = 32768;
    int b4 = 128;
    int b5 = 128;
    buf.putInt(b1);
    buf.putInt(b2);
    buf.putInt(b3);

    buf.flip();
    assertEquals(b1, buf.getInt());
    assertEquals(b2, buf.getInt());
    buf.rewind();
    buf.putIntAt(0, b4);
    buf.putIntAt(4, b5);
    assertEquals(b4, buf.getIntAt(0));
    assertEquals(b5, buf.getIntAt(4));
  }
  @Test
  public void testGetAndSetUnsignedShort() throws Exception {
    WrappedByteBuffer buf = new WrappedByteBuffer();
    buf.putUnsignedShort(0);
    buf.putUnsignedShort(65535);
    buf.putUnsignedShort(65536);
    buf.putUnsignedShort(-1);

    buf.flip();
    assertEquals(0, buf.getUnsignedShort());
    assertEquals(65535, buf.getUnsignedShort());
    assertEquals(0, buf.getUnsignedShort());
    assertEquals(65535, buf.getUnsignedShort());

    buf.rewind();
    buf.putUnsignedShortAt(0, 121);
    buf.putUnsignedShortAt(2, 122);
    assertEquals(121, buf.getUnsignedShortAt(0));
    assertEquals(122, buf.getUnsignedShortAt(2));
  }
  // Long tests
  @Test
  public void testGetAndSetLong() throws Exception {
    WrappedByteBuffer buf = new WrappedByteBuffer();
    long b1 = -9223372036854775808L;
    long b2 = 9223372036854775807L;
    long b3 = 32768;
    long b4 = 543210987654321L;
    long b5 = 123456789012345L;
    buf.putLong(b1);
    buf.putLong(b2);
    buf.putLong(b3);
    buf.flip();

    assertEquals(b1, buf.getLong());
    assertEquals(b2, buf.getLong());

    buf.rewind();
    buf.putLongAt(0, b4);
    buf.putLongAt(8, b5);
    assertEquals(b4, buf.getLongAt(0));
    assertEquals(b5, buf.getLongAt(8));
  }