2019-02-28 10:04:06 +08:00
|
|
|
#include "../singleheader/simdjson.h"
|
2019-06-27 07:48:51 +08:00
|
|
|
#include <iostream>
|
2019-02-28 10:04:06 +08:00
|
|
|
|
2019-07-03 04:24:56 +08:00
|
|
|
using namespace simdjson;
|
|
|
|
|
2019-02-28 10:04:06 +08:00
|
|
|
int main() {
|
2019-06-27 07:48:51 +08:00
|
|
|
const char *filename = JSON_TEST_PATH;
|
2019-05-10 05:59:51 +08:00
|
|
|
padded_string p = get_corpus(filename);
|
2019-02-28 10:04:06 +08:00
|
|
|
ParsedJson pj = build_parsed_json(p); // do the parsing
|
2019-07-31 05:18:10 +08:00
|
|
|
if (!pj.is_valid()) {
|
2019-02-28 10:04:06 +08:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2019-07-31 05:18:10 +08:00
|
|
|
if (!pj.allocate_capacity(p.size())) {
|
2019-03-07 13:49:27 +08:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2019-03-03 06:18:45 +08:00
|
|
|
const int res = json_parse(p, pj);
|
|
|
|
if (res) {
|
2019-07-31 05:18:10 +08:00
|
|
|
std::cerr << error_message(res) << std::endl;
|
2019-03-03 06:18:45 +08:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2019-02-28 10:04:06 +08:00
|
|
|
return EXIT_SUCCESS;
|
2019-05-10 05:59:51 +08:00
|
|
|
}
|