예제 #1
0
  private void check(Range rng, int a, int b) {
    rng.set(a, b);

    eq(rng, a, b);
    eq(rng.limit(), rng.start + rng.length);

    long backup = rng.backup();
    rng.set(rnd(), rnd());

    rng.restore(backup);
    eq(rng, a, b);
  }
예제 #2
0
  @Test
  public void shouldBackupAndRestore() {
    Range range = new Range(10, 3);
    eq(range, 10, 3);

    long backup = range.backup();

    range.set(7, 17);
    eq(range, 7, 17);

    range.restore(backup);
    eq(range, 10, 3);
  }