Exemplo n.º 1
0
  /** Unit test for HeapFile.getId() */
  @Test
  public void getId() throws Exception {
    int id = hf.getId();

    // NOTE(ghuo): the value could be anything. test determinism, at least.
    assertEquals(id, hf.getId());
    assertEquals(id, hf.getId());

    HeapFile other = SystemTestUtil.createRandomHeapFile(1, 1, null, null);
    assertTrue(id != other.getId());
  }
Exemplo n.º 2
0
  /** Unit test for HeapFile.readPage() */
  @Test
  public void readPage() throws Exception {
    HeapPageId pid = new HeapPageId(hf.getId(), 0);
    HeapPage page = (HeapPage) hf.readPage(pid);

    // NOTE(ghuo): we try not to dig too deeply into the Page API here; we
    // rely on HeapPageTest for that. perform some basic checks.
    assertEquals(484, page.getNumEmptySlots());
    assertTrue(page.isSlotUsed(1));
    assertFalse(page.isSlotUsed(20));
  }