From 98feb209059f039e35cef5b0bbfcf7d99aa1c1ae Mon Sep 17 00:00:00 2001 From: Yoni Fogel Date: Fri, 6 Jun 2008 16:45:38 +0000 Subject: [PATCH] Addresses #889 Leaf boundary test now checks left to right and right to left. git-svn-id: file:///svn/tokudb@4401 c7de825b-a66e-492c-adef-691d508d4ae1 --- src/tests/cursor-more-than-a-leaf-provdel.c | 25 ++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/tests/cursor-more-than-a-leaf-provdel.c b/src/tests/cursor-more-than-a-leaf-provdel.c index 3f10f44356b..770a6a23620 100644 --- a/src/tests/cursor-more-than-a-leaf-provdel.c +++ b/src/tests/cursor-more-than-a-leaf-provdel.c @@ -65,13 +65,28 @@ void doit (BOOL committed_provdels) { r=env->txn_begin(env, 0, &txn, 0); CKERR(r); r = db->cursor(db, txn, &dbc, 0); CKERR(r); } - i=2*num_insert; - j=(i<<1)+37; - r=db->put(db, txn, dbt_init(&key, &i, sizeof(i)), dbt_init(&data, &j, sizeof(j)), DB_YESOVERWRITE); + int ifirst, ilast, jfirst, jlast; + ilast=2*num_insert; + jlast=(ilast<<1)+37; + ifirst=-1*num_insert; + jfirst=(ifirst<<1)+37; + r=db->put(db, txn, dbt_init(&key, &ifirst, sizeof(ifirst)), dbt_init(&data, &jfirst, sizeof(jfirst)), DB_YESOVERWRITE); + CKERR(r); + r=db->put(db, txn, dbt_init(&key, &ilast, sizeof(ilast)), dbt_init(&data, &jlast, sizeof(jlast)), DB_YESOVERWRITE); + CKERR(r); r = dbc->c_get(dbc, dbt_init(&key, NULL, 0), dbt_init(&data, NULL, 0), DB_FIRST); CKERR(r); - assert(*(int*)key.data == i); - assert(*(int*)data.data == j); + assert(*(int*)key.data == ifirst); + assert(*(int*)data.data == jfirst); + r = dbc->c_get(dbc, dbt_init(&key, NULL, 0), dbt_init(&data, NULL, 0), DB_NEXT); CKERR(r); + assert(*(int*)key.data == ilast); + assert(*(int*)data.data == jlast); + r = dbc->c_get(dbc, dbt_init(&key, NULL, 0), dbt_init(&data, NULL, 0), DB_LAST); CKERR(r); + assert(*(int*)key.data == ilast); + assert(*(int*)data.data == jlast); + r = dbc->c_get(dbc, dbt_init(&key, NULL, 0), dbt_init(&data, NULL, 0), DB_PREV); CKERR(r); + assert(*(int*)key.data == ifirst); + assert(*(int*)data.data == jfirst); r = dbc->c_close(dbc); CKERR(r); r=txn->commit(txn, 0); CKERR(r); }