Added verification for json output

This commit is contained in:
Jordan Cristiano 2015-06-19 14:15:23 -04:00
parent d1921abc9f
commit 60888b0c97

View File

@ -1,6 +1,7 @@
#include "io/idemowriter.h" #include "io/idemowriter.h"
#include "io/demoreader.h" #include "io/demoreader.h"
#include "json_checker/JSON_checker.h"
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include <cassert> #include <cassert>
@ -114,5 +115,24 @@ int main(const int argc, const char* argv[])
fclose(inputFp); fclose(inputFp);
fclose(outputFp); fclose(outputFp);
if (outputType == FileType::Json)
{
FILE* outputFp = fopen(outputFile.c_str(), "rb");
JSON_checker jc = new_JSON_checker(20);
int next_char = 0;
while ((next_char = fgetc(outputFp)) > 0)
{
if (!JSON_checker_char(jc, next_char))
{
fprintf(stderr, "JSON_checker_char: syntax error\n");
}
}
if (!JSON_checker_done(jc))
{
fprintf(stderr, "JSON_checker_end: syntax error\n");
}
fclose(outputFp);
}
return 0; return 0;
} }