nostrdb

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

commit bc35522f9917639b1903212aa54aca6a2f580cff
parent b3718f92a14c139be3c0aa77c04943ffe97bd147
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 19 Jul 2023 22:54:36 -0700

test: empty tags

Diffstat:
Mtest.c | 22++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/test.c b/test.c @@ -6,7 +6,7 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -int main(int argc, const char *argv[]) { +static void test_basic_event() { struct ndb_builder builder, *b = &builder; struct ndb_note *note; int len, ok; @@ -63,6 +63,24 @@ int main(int argc, const char *argv[]) { ok = ndb_tags_iterate_next(it); assert(!ok); +} + +static void test_empty_tags() { + struct ndb_builder builder, *b = &builder; + struct ndb_iterator iter, *it = &iter; + struct ndb_note *note; + int ok, len; - fwrite(note, len, 1, stdout); + ndb_builder_new(b, 0); + len = ndb_builder_finalize(b, &note); + + assert(note->tags.count == 0); + + ok = ndb_tags_iterate_start(note, it); + assert(!ok); +} + +int main(int argc, const char *argv[]) { + test_basic_event(); + test_empty_tags(); }