You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
638 B

11 years ago
#include "../src/common.h"
11 years ago
#include "../src/database.h"
9 years ago
int main()
11 years ago
{
9 years ago
imdb_db_t db;
imdb_rec_t rec[2];
9 years ago
imdb_block_t blk;
11 years ago
char *path = "test.db";
unlink(path);
9 years ago
assert(imdb_open(&db, path, 1) == 1);
11 years ago
rec[0].num = 1;
9 years ago
assert(imdb_read_rec(&db, rec) == 0);
11 years ago
10 years ago
memset(rec[0].data, 0xAA, IMDB_REC_LEN);
9 years ago
assert(imdb_write_rec(&db, rec) == 1);
11 years ago
9 years ago
assert(imdb_read_rec(&db, rec) == 1);
11 years ago
11 years ago
blk.start = 1;
blk.records = 2;
blk.data = NULL;
9 years ago
assert(imdb_read_blk(&db, &blk) == 1);
11 years ago
assert(blk.records == 1);
assert(blk.data != NULL);
11 years ago
rec[0].num = 1;
rec[1].num = 3;
assert(imdb_close(&db) == 0);
11 years ago
return 0;
}