Add more tests to cmake

This commit is contained in:
John Keiser 2020-04-06 09:45:45 -07:00
parent 10b7556a37
commit 3dcc188d93
8 changed files with 75 additions and 59 deletions

View File

@ -42,7 +42,7 @@ endif()
option(SIMDJSON_SANITIZE "Sanitize addresses" OFF) option(SIMDJSON_SANITIZE "Sanitize addresses" OFF)
option(SIMDJSON_GOOGLE_BENCHMARKS "compile the Google Benchmark benchmarks" OFF) option(SIMDJSON_GOOGLE_BENCHMARKS "compile the Google Benchmark benchmarks" OFF)
option(SIMDJSON_ENABLE_THREADS "enable threaded operation" ON) option(SIMDJSON_ENABLE_THREADS "enable threaded operation" ON)
option(SIMDJSON_EXCEPTIONS "Enable simdjson's exception-throwing interface" ON) option(SIMDJSON_NO_EXCEPTIONS "Disable simdjson's exception-throwing interface" OFF)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake")
@ -58,12 +58,8 @@ add_subdirectory(src)
# #
# Compile tools / tests / benchmarks # Compile tools / tests / benchmarks
# #
set (TEST_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/jsonchecker/") add_definitions(-DSIMDJSON_TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/jsonchecker/")
set (BENCHMARK_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/jsonexamples/") add_definitions(-DSIMDJSON_BENCHMARK_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/jsonexamples/")
add_definitions(-DSIMDJSON_TEST_DATA_DIR="${TEST_DATA_DIR}")
add_definitions(-DSIMDJSON_BENCHMARK_DATA_DIR="${TEST_DATA_DIR}")
add_definitions(-DJSON_TEST_PATH="${BENCHMARK_DATA_DIR}/twitter.json")
add_definitions(-DSIMDJSON_AMAZON_CELLPHONES_NDJSON_PATH="${PROJECT_SOURCE_DIR}/jsonexamples/amazon_cellphones.ndjson")
enable_testing() enable_testing()

View File

@ -6,18 +6,16 @@ using namespace simdjson;
using namespace benchmark; using namespace benchmark;
using namespace std; using namespace std;
#ifndef SIMDJSON_TWITTER_JSON_PATH
#define SIMDJSON_TWITTER_JSON_PATH "jsonexamples/twitter.json"
#endif
const padded_string EMPTY_ARRAY("[]", 2); const padded_string EMPTY_ARRAY("[]", 2);
const char *TWITTER_JSON = SIMDJSON_BENCHMARK_DATA_DIR "";
#if SIMDJSON_EXCEPTIONS #if SIMDJSON_EXCEPTIONS
static void twitter_count(State& state) { static void twitter_count(State& state) {
// Prints the number of results in twitter.json // Prints the number of results in twitter.json
dom::parser parser; dom::parser parser;
dom::element doc = parser.load(SIMDJSON_TWITTER_JSON_PATH); dom::element doc = parser.load(TWITTER_JSON);
for (auto _ : state) { for (auto _ : state) {
uint64_t result_count = doc["search_metadata"]["count"]; uint64_t result_count = doc["search_metadata"]["count"];
if (result_count != 100) { return; } if (result_count != 100) { return; }
@ -29,7 +27,7 @@ SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_DEPRECATED_WARNING SIMDJSON_DISABLE_DEPRECATED_WARNING
static void iterator_twitter_count(State& state) { static void iterator_twitter_count(State& state) {
// Prints the number of results in twitter.json // Prints the number of results in twitter.json
padded_string json = padded_string::load(SIMDJSON_TWITTER_JSON_PATH); padded_string json = padded_string::load(TWITTER_JSON);
ParsedJson pj = build_parsed_json(json); ParsedJson pj = build_parsed_json(json);
for (auto _ : state) { for (auto _ : state) {
ParsedJson::Iterator iter(pj); ParsedJson::Iterator iter(pj);
@ -48,7 +46,7 @@ SIMDJSON_POP_DISABLE_WARNINGS
static void twitter_default_profile(State& state) { static void twitter_default_profile(State& state) {
// Count unique users with a default profile. // Count unique users with a default profile.
dom::parser parser; dom::parser parser;
dom::element doc = parser.load(SIMDJSON_TWITTER_JSON_PATH); dom::element doc = parser.load(TWITTER_JSON);
for (auto _ : state) { for (auto _ : state) {
set<string_view> default_users; set<string_view> default_users;
for (dom::object tweet : doc["statuses"].get<dom::array>()) { for (dom::object tweet : doc["statuses"].get<dom::array>()) {
@ -65,7 +63,7 @@ BENCHMARK(twitter_default_profile);
static void twitter_image_sizes(State& state) { static void twitter_image_sizes(State& state) {
// Count unique image sizes // Count unique image sizes
dom::parser parser; dom::parser parser;
dom::element doc = parser.load(SIMDJSON_TWITTER_JSON_PATH); dom::element doc = parser.load(TWITTER_JSON);
for (auto _ : state) { for (auto _ : state) {
set<tuple<uint64_t, uint64_t>> image_sizes; set<tuple<uint64_t, uint64_t>> image_sizes;
for (dom::object tweet : doc["statuses"].get<dom::array>()) { for (dom::object tweet : doc["statuses"].get<dom::array>()) {
@ -88,7 +86,7 @@ BENCHMARK(twitter_image_sizes);
static void error_code_twitter_count(State& state) noexcept { static void error_code_twitter_count(State& state) noexcept {
// Prints the number of results in twitter.json // Prints the number of results in twitter.json
dom::parser parser; dom::parser parser;
dom::element doc = parser.load(SIMDJSON_TWITTER_JSON_PATH); dom::element doc = parser.load(TWITTER_JSON);
for (auto _ : state) { for (auto _ : state) {
auto [value, error] = doc["search_metadata"]["count"].get<uint64_t>(); auto [value, error] = doc["search_metadata"]["count"].get<uint64_t>();
if (error) { return; } if (error) { return; }
@ -100,7 +98,7 @@ BENCHMARK(error_code_twitter_count);
static void error_code_twitter_default_profile(State& state) noexcept { static void error_code_twitter_default_profile(State& state) noexcept {
// Count unique users with a default profile. // Count unique users with a default profile.
dom::parser parser; dom::parser parser;
dom::element doc = parser.load(SIMDJSON_TWITTER_JSON_PATH); dom::element doc = parser.load(TWITTER_JSON);
for (auto _ : state) { for (auto _ : state) {
set<string_view> default_users; set<string_view> default_users;
@ -127,7 +125,7 @@ SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_DEPRECATED_WARNING SIMDJSON_DISABLE_DEPRECATED_WARNING
static void iterator_twitter_default_profile(State& state) { static void iterator_twitter_default_profile(State& state) {
// Count unique users with a default profile. // Count unique users with a default profile.
padded_string json = padded_string::load(SIMDJSON_TWITTER_JSON_PATH); padded_string json = padded_string::load(TWITTER_JSON);
ParsedJson pj = build_parsed_json(json); ParsedJson pj = build_parsed_json(json);
for (auto _ : state) { for (auto _ : state) {
set<string_view> default_users; set<string_view> default_users;
@ -167,7 +165,7 @@ BENCHMARK(iterator_twitter_default_profile);
static void error_code_twitter_image_sizes(State& state) noexcept { static void error_code_twitter_image_sizes(State& state) noexcept {
// Count unique image sizes // Count unique image sizes
dom::parser parser; dom::parser parser;
dom::element doc = parser.load(SIMDJSON_TWITTER_JSON_PATH); dom::element doc = parser.load(TWITTER_JSON);
for (auto _ : state) { for (auto _ : state) {
set<tuple<uint64_t, uint64_t>> image_sizes; set<tuple<uint64_t, uint64_t>> image_sizes;
auto [statuses, error] = doc["statuses"].get<dom::array>(); auto [statuses, error] = doc["statuses"].get<dom::array>();
@ -196,7 +194,7 @@ SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_DEPRECATED_WARNING SIMDJSON_DISABLE_DEPRECATED_WARNING
static void iterator_twitter_image_sizes(State& state) { static void iterator_twitter_image_sizes(State& state) {
// Count unique image sizes // Count unique image sizes
padded_string json = padded_string::load(SIMDJSON_TWITTER_JSON_PATH); padded_string json = padded_string::load(TWITTER_JSON);
ParsedJson pj = build_parsed_json(json); ParsedJson pj = build_parsed_json(json);
for (auto _ : state) { for (auto _ : state) {
set<tuple<uint64_t, uint64_t>> image_sizes; set<tuple<uint64_t, uint64_t>> image_sizes;
@ -254,7 +252,7 @@ BENCHMARK(iterator_twitter_image_sizes);
static void print_json(State& state) noexcept { static void print_json(State& state) noexcept {
// Prints the number of results in twitter.json // Prints the number of results in twitter.json
padded_string json = get_corpus(SIMDJSON_TWITTER_JSON_PATH); padded_string json = get_corpus(TWITTER_JSON);
dom::parser parser; dom::parser parser;
if (int error = json_parse(json, parser); error != SUCCESS) { cerr << error_message(error) << endl; return; } if (int error = json_parse(json, parser); error != SUCCESS) { cerr << error_message(error) << endl; return; }
for (auto _ : state) { for (auto _ : state) {

View File

@ -9,8 +9,13 @@ else()
endif() endif()
target_sources(simdjson PRIVATE simdjson.cpp) target_sources(simdjson PRIVATE simdjson.cpp)
target_include_directories(simdjson PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
target_include_directories(simdjson PRIVATE .) target_include_directories(simdjson PRIVATE .)
target_include_directories(simdjson PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
if(SIMDJSON_NO_EXCEPTIONS)
message(STATUS "simdjson exception interface turned off. Code that does not check error codes will not compile.")
target_compile_definitions(simdjson PUBLIC SIMDJSON_EXCEPTIONS=0)
endif()
if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") # icc / icpc if(${CMAKE_C_COMPILER_ID} MATCHES "Intel") # icc / icpc
# prevent shared libraries from depending on Intel provided libraries # prevent shared libraries from depending on Intel provided libraries

View File

@ -1,18 +1,42 @@
# Helper so we don't have to repeat ourselves so much # Helper so we don't have to repeat ourselves so much
function(add_cpp_test TEST_NAME) function(add_cpp_test TEST_NAME TEST_FILE)
add_executable(${TEST_NAME} ${TEST_NAME}.cpp) add_executable(${TEST_NAME} ${TEST_FILE})
add_test(${TEST_NAME} ${TEST_NAME}) add_test(${TEST_NAME} ${TEST_NAME})
endfunction(add_cpp_test) endfunction(add_cpp_test)
# Sets a target to only build when you run the test, and expect failure
function(add_compile_fail_test TEST_NAME)
set_target_properties(${TEST_NAME} PROPERTIES
EXCLUDE_FROM_ALL TRUE
EXCLUDE_FROM_DEFAULT_BUILD TRUE)
add_test(NAME ${TEST_NAME}
COMMAND ${CMAKE_COMMAND} --build . --target ${TEST_NAME} --config $<CONFIGURATION>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_tests_properties(${TEST_NAME} PROPERTIES WILL_FAIL TRUE)
endfunction(add_compile_fail_test)
link_libraries(simdjson) link_libraries(simdjson)
add_cpp_test(basictests) # add_executable(allparserscheckfile allparserscheckfile.cpp)
add_cpp_test(errortests) add_cpp_test(basictests basictests.cpp)
add_cpp_test(jsoncheck) add_cpp_test(errortests errortests.cpp)
add_cpp_test(parse_many_test) add_cpp_test(integer_tests integer_tests.cpp)
add_cpp_test(pointercheck) add_cpp_test(jsoncheck jsoncheck.cpp)
add_cpp_test(integer_tests) # add_executable(numberparsingcheck numberparsingcheck.cpp)
add_cpp_test(parse_many_test parse_many_test.cpp)
add_cpp_test(pointercheck pointercheck.cpp)
# add_cpp_test(stringparsingcheck stringparsingcheck.cpp)
# Compile-only tests
add_executable(readme_examples readme_examples.cpp)
add_executable(readme_examples_noexceptions readme_examples_noexceptions.cpp)
target_compile_options(readme_examples_noexceptions PRIVATE -fno-exceptions)
# Test that readme_examples does NOT compile when SIMDJSON_EXCEPTIONS=0 (i.e. test that the define
# works even if exceptions are on)
add_executable(readme_examples_will_fail_with_exceptions_off readme_examples.cpp)
target_compile_definitions(readme_examples_will_fail_with_exceptions_off PRIVATE SIMDJSON_EXCEPTIONS=0)
add_compile_fail_test(readme_examples_will_fail_with_exceptions_off)
if(MSVC) if(MSVC)
include_directories($<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/windows>) include_directories($<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/windows>)

View File

@ -17,12 +17,11 @@
#include "simdjson.h" #include "simdjson.h"
#ifndef SIMDJSON_TWITTER_JSON_PATH #ifndef SIMDJSON_BENCHMARK_DATA_DIR
#define SIMDJSON_TWITTER_JSON_PATH "jsonexamples/twitter.json" #define SIMDJSON_BENCHMARK_DATA_DIR "jsonexamples/"
#endif
#ifndef SIMDJSON_AMAZON_CELLPHONES_NDJSON_PATH
#define SIMDJSON_AMAZON_CELLPHONES_NDJSON_PATH "jsonexamples/amazon_cellphones.ndjson"
#endif #endif
const char *TWITTER_JSON = SIMDJSON_BENCHMARK_DATA_DIR "twitter.json";
const char *AMAZON_CELLPHONES_NDJSON = SIMDJSON_BENCHMARK_DATA_DIR "amazon_cellphones.ndjson";
#define ASSERT_EQUAL(ACTUAL, EXPECTED) if ((ACTUAL) != (EXPECTED)) { std::cerr << "Expected " << #ACTUAL << " to be " << (EXPECTED) << ", got " << (ACTUAL) << " instead!" << std::endl; return false; } #define ASSERT_EQUAL(ACTUAL, EXPECTED) if ((ACTUAL) != (EXPECTED)) { std::cerr << "Expected " << #ACTUAL << " to be " << (EXPECTED) << ", got " << (ACTUAL) << " instead!" << std::endl; return false; }
#define ASSERT_TRUE(ACTUAL) ASSERT_EQUAL(ACTUAL, true) #define ASSERT_TRUE(ACTUAL) ASSERT_EQUAL(ACTUAL, true)
@ -493,18 +492,18 @@ namespace parse_api_tests {
// } // }
bool parser_load() { bool parser_load() {
std::cout << "Running " << __func__ << std::endl; std::cout << "Running " << __func__ << " on " << TWITTER_JSON << std::endl;
dom::parser parser; dom::parser parser;
auto [doc, error] = parser.load(SIMDJSON_TWITTER_JSON_PATH); auto [doc, error] = parser.load(TWITTER_JSON);
if (error) { cerr << error << endl; return false; } if (error) { cerr << error << endl; return false; }
if (!doc.is<dom::object>()) { cerr << "Document did not parse as an object" << endl; return false; } if (!doc.is<dom::object>()) { cerr << "Document did not parse as an object" << endl; return false; }
return true; return true;
} }
bool parser_load_many() { bool parser_load_many() {
std::cout << "Running " << __func__ << std::endl; std::cout << "Running " << __func__ << " on " << AMAZON_CELLPHONES_NDJSON << std::endl;
dom::parser parser; dom::parser parser;
int count = 0; int count = 0;
for (auto [doc, error] : parser.load_many(SIMDJSON_AMAZON_CELLPHONES_NDJSON_PATH)) { for (auto [doc, error] : parser.load_many(AMAZON_CELLPHONES_NDJSON)) {
if (error) { cerr << error << endl; return false; } if (error) { cerr << error << endl; return false; }
if (!doc.is<dom::array>()) { cerr << "Document did not parse as an array" << endl; return false; } if (!doc.is<dom::array>()) { cerr << "Document did not parse as an array" << endl; return false; }
count++; count++;
@ -537,7 +536,7 @@ namespace parse_api_tests {
bool parser_load_exception() { bool parser_load_exception() {
std::cout << "Running " << __func__ << std::endl; std::cout << "Running " << __func__ << std::endl;
dom::parser parser; dom::parser parser;
const element doc = parser.load(SIMDJSON_TWITTER_JSON_PATH); const element doc = parser.load(TWITTER_JSON);
if (!doc.is<dom::object>()) { cerr << "Document did not parse as an object" << endl; return false; } if (!doc.is<dom::object>()) { cerr << "Document did not parse as an object" << endl; return false; }
return true; return true;
} }
@ -545,7 +544,7 @@ namespace parse_api_tests {
std::cout << "Running " << __func__ << std::endl; std::cout << "Running " << __func__ << std::endl;
dom::parser parser; dom::parser parser;
int count = 0; int count = 0;
for (const element doc : parser.load_many(SIMDJSON_AMAZON_CELLPHONES_NDJSON_PATH)) { for (const element doc : parser.load_many(AMAZON_CELLPHONES_NDJSON)) {
if (!doc.is<dom::array>()) { cerr << "Document did not parse as an array" << endl; return false; } if (!doc.is<dom::array>()) { cerr << "Document did not parse as an array" << endl; return false; }
count++; count++;
} }
@ -869,7 +868,7 @@ namespace dom_api_tests {
std::cout << "Running " << __func__ << std::endl; std::cout << "Running " << __func__ << std::endl;
// Prints the number of results in twitter.json // Prints the number of results in twitter.json
dom::parser parser; dom::parser parser;
auto [result_count, error] = parser.load(SIMDJSON_TWITTER_JSON_PATH)["search_metadata"]["count"].get<uint64_t>(); auto [result_count, error] = parser.load(TWITTER_JSON)["search_metadata"]["count"].get<uint64_t>();
if (error) { cerr << "Error: " << error << endl; return false; } if (error) { cerr << "Error: " << error << endl; return false; }
if (result_count != 100) { cerr << "Expected twitter.json[metadata_count][count] = 100, got " << result_count << endl; return false; } if (result_count != 100) { cerr << "Expected twitter.json[metadata_count][count] = 100, got " << result_count << endl; return false; }
return true; return true;
@ -880,7 +879,7 @@ namespace dom_api_tests {
// Print users with a default profile. // Print users with a default profile.
set<string_view> default_users; set<string_view> default_users;
dom::parser parser; dom::parser parser;
auto [tweets, error] = parser.load(SIMDJSON_TWITTER_JSON_PATH)["statuses"].get<dom::array>(); auto [tweets, error] = parser.load(TWITTER_JSON)["statuses"].get<dom::array>();
if (error) { cerr << "Error: " << error << endl; return false; } if (error) { cerr << "Error: " << error << endl; return false; }
for (auto tweet : tweets) { for (auto tweet : tweets) {
object user; object user;
@ -905,7 +904,7 @@ namespace dom_api_tests {
// Print image names and sizes // Print image names and sizes
set<pair<uint64_t, uint64_t>> image_sizes; set<pair<uint64_t, uint64_t>> image_sizes;
dom::parser parser; dom::parser parser;
auto [tweets, error] = parser.load(SIMDJSON_TWITTER_JSON_PATH)["statuses"].get<dom::array>(); auto [tweets, error] = parser.load(TWITTER_JSON)["statuses"].get<dom::array>();
if (error) { cerr << "Error: " << error << endl; return false; } if (error) { cerr << "Error: " << error << endl; return false; }
for (auto tweet : tweets) { for (auto tweet : tweets) {
auto [media, not_found] = tweet["entities"]["media"].get<dom::array>(); auto [media, not_found] = tweet["entities"]["media"].get<dom::array>();
@ -1043,7 +1042,7 @@ namespace dom_api_tests {
std::cout << "Running " << __func__ << std::endl; std::cout << "Running " << __func__ << std::endl;
// Prints the number of results in twitter.json // Prints the number of results in twitter.json
dom::parser parser; dom::parser parser;
element doc = parser.load(SIMDJSON_TWITTER_JSON_PATH); element doc = parser.load(TWITTER_JSON);
uint64_t result_count = doc["search_metadata"]["count"]; uint64_t result_count = doc["search_metadata"]["count"];
if (result_count != 100) { cerr << "Expected twitter.json[metadata_count][count] = 100, got " << result_count << endl; return false; } if (result_count != 100) { cerr << "Expected twitter.json[metadata_count][count] = 100, got " << result_count << endl; return false; }
return true; return true;
@ -1054,7 +1053,7 @@ namespace dom_api_tests {
// Print users with a default profile. // Print users with a default profile.
set<string_view> default_users; set<string_view> default_users;
dom::parser parser; dom::parser parser;
element doc = parser.load(SIMDJSON_TWITTER_JSON_PATH); element doc = parser.load(TWITTER_JSON);
for (object tweet : doc["statuses"].get<dom::array>()) { for (object tweet : doc["statuses"].get<dom::array>()) {
object user = tweet["user"]; object user = tweet["user"];
if (user["default_profile"]) { if (user["default_profile"]) {
@ -1070,7 +1069,7 @@ namespace dom_api_tests {
// Print image names and sizes // Print image names and sizes
set<pair<uint64_t, uint64_t>> image_sizes; set<pair<uint64_t, uint64_t>> image_sizes;
dom::parser parser; dom::parser parser;
element doc = parser.load(SIMDJSON_TWITTER_JSON_PATH); element doc = parser.load(TWITTER_JSON);
for (object tweet : doc["statuses"].get<dom::array>()) { for (object tweet : doc["statuses"].get<dom::array>()) {
auto [media, not_found] = tweet["entities"]["media"]; auto [media, not_found] = tweet["entities"]["media"];
if (!not_found) { if (!not_found) {

View File

@ -14,9 +14,10 @@
using namespace simdjson; using namespace simdjson;
using namespace std; using namespace std;
#ifndef SIMDJSON_TWITTER_JSON_PATH #ifndef SIMDJSON_BENCHMARK_DATA_DIR
#define SIMDJSON_TWITTER_JSON_PATH "jsonexamples/twitter.json" #define SIMDJSON_BENCHMARK_DATA_DIR "jsonexamples/"
#endif #endif
const char *TWITTER_JSON = SIMDJSON_BENCHMARK_DATA_DIR "twitter.json";
#define TEST_START() { cout << "Running " << __func__ << " ..." << endl; } #define TEST_START() { cout << "Running " << __func__ << " ..." << endl; }
#define ASSERT_ERROR(ACTUAL, EXPECTED) if ((ACTUAL) != (EXPECTED)) { cerr << "FAIL: Unexpected error \"" << (ACTUAL) << "\" (expected \"" << (EXPECTED) << "\")" << endl; return false; } #define ASSERT_ERROR(ACTUAL, EXPECTED) if ((ACTUAL) != (EXPECTED)) { cerr << "FAIL: Unexpected error \"" << (ACTUAL) << "\" (expected \"" << (EXPECTED) << "\")" << endl; return false; }
@ -27,14 +28,14 @@ namespace parser_load {
bool parser_load_capacity() { bool parser_load_capacity() {
TEST_START(); TEST_START();
dom::parser parser(1); // 1 byte max capacity dom::parser parser(1); // 1 byte max capacity
auto [doc, error] = parser.load(SIMDJSON_TWITTER_JSON_PATH); auto [doc, error] = parser.load(TWITTER_JSON);
ASSERT_ERROR(error, CAPACITY); ASSERT_ERROR(error, CAPACITY);
TEST_SUCCEED(); TEST_SUCCEED();
} }
bool parser_load_many_capacity() { bool parser_load_many_capacity() {
TEST_START(); TEST_START();
dom::parser parser(1); // 1 byte max capacity dom::parser parser(1); // 1 byte max capacity
for (auto [doc, error] : parser.load_many(SIMDJSON_TWITTER_JSON_PATH)) { for (auto [doc, error] : parser.load_many(TWITTER_JSON)) {
ASSERT_ERROR(error, CAPACITY); ASSERT_ERROR(error, CAPACITY);
TEST_SUCCEED(); TEST_SUCCEED();
} }

View File

@ -5,7 +5,7 @@
using namespace simdjson; using namespace simdjson;
int main() { int main() {
const char *filename = SIMDJSON_TWITTER_JSON_PATH; const char *filename = SIMDJSON_BENCHMARK_DATA_DIR "/twitter.json";
padded_string p = get_corpus(filename); padded_string p = get_corpus(filename);
dom::parser parser; dom::parser parser;
auto [doc, error] = parser.parse(p); auto [doc, error] = parser.parse(p);

View File

@ -18,13 +18,6 @@ else ()
set (X64 FALSE) set (X64 FALSE)
endif () endif ()
if(SIMDJSON_EXCEPTIONS)
set(OPT_FLAGS "${OPT_FLAGS} -DSIMDJSON_EXCEPTIONS=1")
else()
message(STATUS "simdjson exception interface turned off. Code that does not check error codes will not compile.")
set(OPT_FLAGS "${OPT_FLAGS} -DSIMDJSON_EXCEPTIONS=0")
endif()
if(MSVC) if(MSVC)
set(CXXSTD_FLAGS "/std:c++17") set(CXXSTD_FLAGS "/std:c++17")
else() else()