Exemplo n.º 1
0
  public void testIntegerAt() {
    Int64Array a = Int64Array.make(new long[] {0, 1, -2, 3});

    AssertArrays.assertEquals(IntegerValue.make(0), a.integerAt(0));
    AssertArrays.assertEquals(IntegerValue.make(1), a.integerAt(1));
    AssertArrays.assertEquals(IntegerValue.make(-2), a.integerAt(2));
    AssertArrays.assertEquals(IntegerValue.make(3), a.integerAt(3));

    try {
      a.integerAt(-1);
      fail("-1");
    } catch (IndexOutOfBoundsException e) {
      // expected
    }
    try {
      a.integerAt(4);
      fail("4");
    } catch (IndexOutOfBoundsException e) {
      // expected
    }
  }