From d2d14fe7ee6dad07eab83cc37c1bb5c0fa42aad6 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Tue, 22 Apr 2008 15:09:38 +0000 Subject: update unit tests to cover more of big index code; fix tail promotion/demotion git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@339 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../healthmarketscience/jackcess/BigIndexTest.java | 30 ++++++++-------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'test/src/java/com') diff --git a/test/src/java/com/healthmarketscience/jackcess/BigIndexTest.java b/test/src/java/com/healthmarketscience/jackcess/BigIndexTest.java index 1a7ab87..522148e 100644 --- a/test/src/java/com/healthmarketscience/jackcess/BigIndexTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/BigIndexTest.java @@ -89,7 +89,7 @@ public class BigIndexTest extends TestCase { DatabaseTest._autoSync = false; try { - String extraText = " some random text to fill out the index and make it fill up pages"; + String extraText = " some random text to fill out the index and make it fill up pages with lots of extra bytes so i will keep typing until i think that i probably have enough text in the index entry so that i do not need to add as many entries in order"; // copy to temp file and attempt to edit db = openCopy(origFile); @@ -137,9 +137,16 @@ public class BigIndexTest extends TestCase { ((BigIndex)index).validate(); - // remove all but the first two entries - Cursor cursor = new CursorBuilder(t).setIndex(index) - .afterLast().toCursor(); + // delete an entry in the middle + Cursor cursor = Cursor.createIndexCursor(t, index); + for(int i = 0; i < (rowCount / 2); ++i) { + assertTrue(cursor.moveToNextRow()); + } + cursor.deleteCurrentRow(); + --rowCount; + + // remove all but the first two entries (from the end) + cursor.afterLast(); for(int i = 0; i < (rowCount - 2); ++i) { assertTrue(cursor.moveToPreviousRow()); cursor.deleteCurrentRow(); @@ -193,19 +200,4 @@ public class BigIndexTest extends TestCase { } } -// public void testBigIndex2() throws Exception -// { -// File f = new File("test/data/databaseTest19731_ind.mdb"); -// Database db = open(f); -// Table t = db.getTable("test"); -// System.out.println("FOO reading index"); -// Index index = t.getIndexes().get(0); -// index.initialize(); -// index.forceInit(); -// index.validate(); -// System.out.println(index); -// db.close(); -// } - - } -- cgit v1.2.3