コード例 #1
0
ファイル: TestSlice.java プロジェクト: nileema/slice
  private static void assertLexicographicallySortableLong(Slice slice, int index) {
    // fill slice with FF
    slice.fill((byte) 0xFF);

    // set and get the value
    slice.setLexicographicallySortableLong(index, 0xAAAA_AAAA_5555_5555L);
    assertEquals(slice.getLexicographicallySortableLong(index), 0xAAAA_AAAA_5555_5555L);

    try {
      slice.getLexicographicallySortableLong(-1);
      fail("expected IndexOutOfBoundsException");
    } catch (IndexOutOfBoundsException e) {
    }

    try {
      slice.getLexicographicallySortableLong((slice.length() - SIZE_OF_LONG) + 1);
      fail("expected IndexOutOfBoundsException");
    } catch (IndexOutOfBoundsException e) {
    }

    try {
      slice.getLexicographicallySortableLong(slice.length());
      fail("expected IndexOutOfBoundsException");
    } catch (IndexOutOfBoundsException e) {
    }

    try {
      slice.getLexicographicallySortableLong(slice.length() + 1);
      fail("expected IndexOutOfBoundsException");
    } catch (IndexOutOfBoundsException e) {
    }
  }