nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit b4f2ff1eda4358629c847446c5311cc4b5ab91dc
parent f7b1bc0cdcd0b3d02dc6b96ca8be7b267c9da3e4
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 30 Dec 2023 20:22:05 -0800

test: make sure the block types are correct

Diffstat:
Mtest.c | 24+++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/test.c b/test.c @@ -834,11 +834,25 @@ static void test_url_parsing() { while ((block = ndb_blocks_iterate_next(iter))) { str = ndb_block_str(block); switch (++i) { - case 1: assert(!strncmp(str->str, DAMUSIO, str->len)); break; - case 2: assert(!strncmp(str->str, ", ", str->len)); break; - case 3: assert(!strncmp(str->str, JB55COM, str->len)); break; - case 4: assert(!strncmp(str->str, ", ", str->len)); break; - case 5: assert(!strncmp(str->str, WIKIORG, str->len)); break; + case 1: + assert(ndb_get_block_type(block) == BLOCK_URL); + assert(!strncmp(str->str, DAMUSIO, str->len)); + break; + case 2: + assert(ndb_get_block_type(block) == BLOCK_TEXT); + assert(!strncmp(str->str, ", ", str->len)); + break; + case 3: + assert(ndb_get_block_type(block) == BLOCK_URL); + assert(!strncmp(str->str, JB55COM, str->len)); + break; + case 4: + assert(ndb_get_block_type(block) == BLOCK_TEXT); + assert(!strncmp(str->str, ", ", str->len)); + break; + case 5: + assert(ndb_get_block_type(block) == BLOCK_URL); + assert(!strncmp(str->str, WIKIORG, str->len)); break; } }