nostrdb

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

myissue.c (1006B)


      1 /* Minimal test with all headers generated into a single file. */
      2 #include "build/myissue_generated.h"
      3 #include "flatcc/support/hexdump.h"
      4 
      5 int main(int argc, char *argv[])
      6 {
      7     int ret;
      8     void *buf;
      9     size_t size;
     10     flatcc_builder_t builder, *B;
     11 
     12     (void)argc;
     13     (void)argv;
     14 
     15     B = &builder;
     16     flatcc_builder_init(B);
     17 
     18     Eclectic_FooBar_start_as_root(B);
     19     Eclectic_FooBar_say_create_str(B, "hello");
     20     Eclectic_FooBar_meal_add(B, Eclectic_Fruit_Orange);
     21     Eclectic_FooBar_height_add(B, -8000);
     22     Eclectic_FooBar_end_as_root(B);
     23     buf = flatcc_builder_get_direct_buffer(B, &size);
     24 #if defined(PROVOKE_ERROR) || 0
     25     /* Provoke error for testing. */
     26     ((char*)buf)[0] = 42;
     27 #endif
     28     ret = Eclectic_FooBar_verify_as_root(buf, size);
     29     if (ret) {
     30         hexdump("Eclectic.FooBar buffer for myissue", buf, size, stdout);
     31         printf("could not verify Electic.FooBar table, got %s\n", flatcc_verify_error_string(ret));
     32     }
     33     flatcc_builder_clear(B);
     34     return ret;
     35 }