MCPcopy Create free account
hub / github.com/1345414527/MIT6.830 / insertTuple

Method insertTuple

test/simpledb/BufferPoolWriteTest.java:73–89  ·  view source on GitHub ↗

Unit test for BufferPool.insertTuple()

()

Source from the content-addressed store, hash-verified

71 * Unit test for BufferPool.insertTuple()
72 */
73 @Test public void insertTuple() throws Exception {
74 // we should be able to add 504 tuples on an empty page.
75 for (int i = 0; i < 504; ++i) {
76 Tuple t = Utility.getHeapTuple(i, 2);
77 Database.getBufferPool().insertTuple(tid, empty.getId(), t);
78 HeapPage p = (HeapPage) Database.getBufferPool().getPage(tid, t.getRecordId().getPageId(), Permissions.READ_ONLY);
79 assertEquals(504-i-1, p.getNumEmptySlots());
80 }
81
82 // the next 504 additions should live on a new page
83 for (int i = 0; i < 504; ++i) {
84 Tuple t = Utility.getHeapTuple(i, 2);
85 Database.getBufferPool().insertTuple(tid, empty.getId(), t);
86 HeapPage p = (HeapPage) Database.getBufferPool().getPage(tid, t.getRecordId().getPageId(), Permissions.READ_ONLY);
87 assertEquals(504-i-1, p.getNumEmptySlots());
88 }
89 }
90
91 /**
92 * Unit test for BufferPool.deleteTuple()

Callers

nothing calls this directly

Calls 8

getHeapTupleMethod · 0.95
getBufferPoolMethod · 0.95
getRecordIdMethod · 0.95
getNumEmptySlotsMethod · 0.95
insertTupleMethod · 0.65
getIdMethod · 0.65
getPageMethod · 0.45
getPageIdMethod · 0.45

Tested by

no test coverage detected