Skip to content

Commit

Permalink
feat: Add integration testing JSON reader (#322)
Browse files Browse the repository at this point in the history
This PR adds a `TestingJSONReader`. It uses
https://github.com/nlohmann/json to do the parsing. This doesn't
implement parsing a record batch or array yet, and there are a few
missing types (the same missing types as the writer). I'd like to do
those as a follow-up.

The testing for this is mostly roundtrip testing, which is maybe not
ideal but also maybe OK because the writer is an independent
implementation. When the ability to compare schemas for equality gets
added that can be tacked on to the roundtrip test utility function as
well.
  • Loading branch information
paleolimbot authored Nov 27, 2023
1 parent 97bb65e commit d37d2b0
Show file tree
Hide file tree
Showing 3 changed files with 744 additions and 1 deletion.
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,16 @@ if(NANOARROW_BUILD_TESTS)

fetchcontent_makeavailable(googletest)

# JSON library for integration testing
# Also used by some versions of Arrow, so check if this is already available
if(NOT TARGET nlohmann_json::nlohmann_json)
fetchcontent_declare(nlohmann_json
URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.zip
URL_HASH SHA256=95651d7d1fcf2e5c3163c3d37df6d6b3e9e5027299e6bd050d157322ceda9ac9
)
fetchcontent_makeavailable(nlohmann_json)
endif()

add_executable(utils_test src/nanoarrow/utils_test.cc)
add_executable(buffer_test src/nanoarrow/buffer_test.cc)
add_executable(array_test src/nanoarrow/array_test.cc)
Expand Down Expand Up @@ -235,7 +245,11 @@ if(NANOARROW_BUILD_TESTS)
coverage_config)
target_link_libraries(array_stream_test nanoarrow gtest_main coverage_config)
target_link_libraries(nanoarrow_hpp_test nanoarrow gtest_main coverage_config)
target_link_libraries(nanoarrow_testing_test nanoarrow gtest_main coverage_config)
target_link_libraries(nanoarrow_testing_test
nanoarrow
gtest_main
nlohmann_json::nlohmann_json
coverage_config)

include(GoogleTest)
# Some users have reported a timeout with the default value of 5
Expand Down
Loading

0 comments on commit d37d2b0

Please sign in to comment.