diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2022-06-29 18:37:11 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2022-06-29 18:37:11 +0200 |
commit | d0b5c9238acc63ec6def1fd16c47f06f8c682f2e (patch) | |
tree | b1f204ee89f0dc0035035bee67559cf2f8c2e19b /src/vdf/tests/index.c | |
parent | d8e48a60b0a9a2b025078bf6b38e360e0ec7e23b (diff) | |
download | OFQT-d0b5c9238acc63ec6def1fd16c47f06f8c682f2e.tar.gz OFQT-d0b5c9238acc63ec6def1fd16c47f06f8c682f2e.zip |
update vdf indexing program to accept integer types
Diffstat (limited to 'src/vdf/tests/index.c')
-rw-r--r-- | src/vdf/tests/index.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/vdf/tests/index.c b/src/vdf/tests/index.c index c3f96b1..6a07760 100644 --- a/src/vdf/tests/index.c +++ b/src/vdf/tests/index.c @@ -8,6 +8,7 @@ * on a known file */ #include <stdio.h> +#include <assert.h> #include "vdf.h" @@ -38,12 +39,27 @@ int main(int argc, char** argv) } } - int retval = k->type != VDF_TYPE_STRING; + int retval = k != NULL && k->type == VDF_TYPE_ARRAY; - if (retval) + if (!k || retval) vdf_print_object(k); else - puts(k->data.data_string.str); + { + switch(k->type) + { + case VDF_TYPE_STRING: + puts(k->data.data_string.str); + break; + + case VDF_TYPE_INT: + printf("%lli\n", k->data.data_int); + break; + + default: + assert(0); + } + + } vdf_free_object(o); |