mariadb/newbrt/tests/test_logcursor.c
Dave Wells d6e96be1f0 MERGE tokudb/toku/tokudb/1857 into main, refs [t:1857]
git-svn-id: file:///svn/toku/tokudb@13431 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:57:55 -04:00

44 lines
1.9 KiB
C

#include <toku_portability.h>
#include <string.h>
#include "test.h"
#include "brttypes.h"
#include "includes.h"
int test_main(int argc __attribute__((unused)), const char *argv[] __attribute__((unused))) {
int r=0;
char dbdir[100] = "/home/wells/svn/tokudb.1857/src/tests/dir.x1.c.tdb";
struct toku_logcursor *cursor;
struct log_entry entry;
r = toku_logcursor_create(&cursor, dbdir);
if ( r!=0 ) return r;
r = toku_logcursor_next(cursor, &entry); printf("Entry = %c\n", entry.cmd);
r = toku_logcursor_next(cursor, &entry); printf("Entry = %c\n", entry.cmd);
r = toku_logcursor_next(cursor, &entry); printf("Entry = %c\n", entry.cmd);
printf("r=%d\n", r);
r = toku_logcursor_destroy(&cursor);
r = toku_logcursor_create(&cursor, dbdir);
if ( r!=0 ) return r;
r = toku_logcursor_prev(cursor, &entry); printf("Entry = %c\n", entry.cmd);
r = toku_logcursor_prev(cursor, &entry); printf("Entry = %c\n", entry.cmd);
r = toku_logcursor_prev(cursor, &entry); printf("Entry = %c\n", entry.cmd);
printf("r=%d\n", r);
r = toku_logcursor_destroy(&cursor);
r = toku_logcursor_create(&cursor, dbdir);
if ( r!=0 ) return r;
r = toku_logcursor_next(cursor, &entry); printf("Entry = %c\n", entry.cmd);
r = toku_logcursor_next(cursor, &entry); printf("Entry = %c\n", entry.cmd);
r = toku_logcursor_next(cursor, &entry); printf("Entry = %c\n", entry.cmd);
r = toku_logcursor_prev(cursor, &entry); printf("Entry = %c\n", entry.cmd);
r = toku_logcursor_prev(cursor, &entry); printf("Entry = %c\n", entry.cmd);
r = toku_logcursor_prev(cursor, &entry); printf("Entry = %c\n", entry.cmd);
r = toku_logcursor_prev(cursor, &entry); printf("Entry = %c\n", entry.cmd);
if ( r == DB_NOTFOUND ) printf("PASS\n"); else printf("FAIL\n");
r = toku_logcursor_destroy(&cursor);
return 0;
}