diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2022-06-28 17:44:01 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2022-06-28 17:44:01 +0200 |
commit | a51036bf447a699511452da773dc4fad02192849 (patch) | |
tree | 116b9ec1d527e02db9023c836721bd046fe320ff /src/vdf/tests/reparse.c | |
parent | a93baa212f3c7b57a08cb9084d38994290195d78 (diff) | |
download | OFQT-a51036bf447a699511452da773dc4fad02192849.tar.gz OFQT-a51036bf447a699511452da773dc4fad02192849.zip |
add unit tests for vdf & md5, allow escaped quotesvdf-parser
Diffstat (limited to 'src/vdf/tests/reparse.c')
-rw-r--r-- | src/vdf/tests/reparse.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/vdf/tests/reparse.c b/src/vdf/tests/reparse.c new file mode 100644 index 0000000..94da4ca --- /dev/null +++ b/src/vdf/tests/reparse.c @@ -0,0 +1,35 @@ +/** + * a command line utility that parses a given + * vdf file and and output it pretty printed + * onto stdout or a specified file + * + * Used for testing to ensure we parse a VDF + * file correctly and can output the same + */ +#include <stdio.h> + +#include "vdf.h" + +int main(int argc, char** argv) +{ + if (argc < 2) + { + puts("vdf_reparse file [output]"); + return 1; + } + else if (argc > 2) + { + freopen(argv[2], "w", stdout); + } + + struct vdf_object* o = vdf_parse_file(argv[1]); + + if (!o) + { + puts("Invalid File"); + return 1; + } + vdf_print_object(o); + + vdf_free_object(o); +}
\ No newline at end of file |