Files
simdjson-simdjson/tests/singleheadertest.cpp
T
Georgios Floros 0ca170b130 Fix crash in singleheader test (#105)
Use `aligned_free` instead of `free` to free memory allocated by aligned function.
2019-03-05 15:35:34 -05:00

19 lines
496 B
C++

#include <iostream>
#include "../singleheader/simdjson.h"
int main() {
const char * filename = JSON_TEST_PATH;
std::string_view p = get_corpus(filename);
ParsedJson pj = build_parsed_json(p); // do the parsing
if( ! pj.isValid() ) {
return EXIT_FAILURE;
}
pj.allocateCapacity(p.size());
const int res = json_parse(p, pj);
if (res) {
std::cerr << simdjson::errorMsg(res) << std::endl;
return EXIT_FAILURE;
}
aligned_free((void*)p.data());
return EXIT_SUCCESS;
}