File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,4 +5,8 @@ target_include_directories(${SIMDJSON_LIB_NAME}
55endif ()
66
77add_cpp_test (jsoncheck )
8- add_test (jsoncheck jsoncheck )
8+
9+ add_executable (singleheader ./singleheadertest.cpp ${PROJECT_SOURCE_DIR } /singleheader/simdjson.cpp )
10+ target_compile_definitions (singleheader PRIVATE JSON_TEST_PATH= "${PROJECT_SOURCE_DIR } /jsonexamples/twitter.json" )
11+ target_link_libraries (singleheader ${SIMDJSON_LIB_NAME} )
12+ add_test (singleheader singleheader )
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ #include " ../singleheader/simdjson.h"
3+
4+ int main () {
5+ const char * filename = JSON_TEST_PATH ;
6+ std::string_view p = get_corpus (filename);
7+ ParsedJson pj = build_parsed_json (p); // do the parsing
8+ if ( ! pj.isValid () ) {
9+ return EXIT_FAILURE ;
10+ }
11+ pj.allocateCapacity (p.size ());
12+ bool is_ok = json_parse (p, pj);
13+ if (!is_ok) {return EXIT_FAILURE ;}
14+ free ((void *)p.data ());
15+ return EXIT_SUCCESS ;
16+ }
You can’t perform that action at this time.
0 commit comments