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.

37 lines
671 B

11 years ago
#include "../src/common.h"
11 years ago
#include "../src/database.h"
int main(int argc, char **argv)
{
imdb_t db;
imdb_rec_t rec[2];
11 years ago
block_t blk;
11 years ago
char *path = "test.db";
unlink(path);
assert(imdb_open(&db, path) == 1);
11 years ago
rec[0].num = 1;
assert(db_rd_rec(&db, rec) == 0);
10 years ago
memset(rec[0].data, 0xAA, IMDB_REC_LEN);
11 years ago
assert(db_wr_rec(&db, rec) == 1);
assert(db_rd_rec(&db, rec) == 1);
11 years ago
blk.start = 1;
blk.records = 2;
blk.data = NULL;
assert(db_rd_blk(&db, &blk) == 1);
assert(blk.records == 1);
assert(blk.data != NULL);
11 years ago
rec[0].num = 1;
rec[1].num = 3;
assert(db_rd_list(&db, rec, 2) == 1);
assert(imdb_close(&db) == 0);
11 years ago
return 0;
}