🚚 rename test folder to tests
2
.github/external_ci/.drone.yml
vendored
@ -18,5 +18,5 @@ steps:
|
|||||||
- cd build
|
- cd build
|
||||||
- ../cmake-3.20.2/bin/cmake .. -DJSON_FastTests=ON
|
- ../cmake-3.20.2/bin/cmake .. -DJSON_FastTests=ON
|
||||||
- make -j10
|
- make -j10
|
||||||
- cd test
|
- cd tests
|
||||||
- ../../cmake-3.20.2/bin/ctest -j10
|
- ../../cmake-3.20.2/bin/ctest -j10
|
||||||
|
|||||||
@ -136,7 +136,7 @@ CONFIGURE_FILE(
|
|||||||
if (JSON_BuildTests)
|
if (JSON_BuildTests)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(test)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
38
Makefile
@ -55,7 +55,7 @@ doctest:
|
|||||||
run_benchmarks:
|
run_benchmarks:
|
||||||
rm -fr cmake-build-benchmarks
|
rm -fr cmake-build-benchmarks
|
||||||
mkdir cmake-build-benchmarks
|
mkdir cmake-build-benchmarks
|
||||||
cd cmake-build-benchmarks ; cmake ../test/benchmarks -GNinja -DCMAKE_BUILD_TYPE=Release
|
cd cmake-build-benchmarks ; cmake ../tests/benchmarks -GNinja -DCMAKE_BUILD_TYPE=Release
|
||||||
cd cmake-build-benchmarks ; ninja
|
cd cmake-build-benchmarks ; ninja
|
||||||
cd cmake-build-benchmarks ; ./json_benchmarks
|
cd cmake-build-benchmarks ; ./json_benchmarks
|
||||||
|
|
||||||
@ -68,41 +68,41 @@ run_benchmarks:
|
|||||||
fuzz_testing:
|
fuzz_testing:
|
||||||
rm -fr fuzz-testing
|
rm -fr fuzz-testing
|
||||||
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
||||||
$(MAKE) parse_afl_fuzzer -C test CXX=afl-clang++
|
$(MAKE) parse_afl_fuzzer -C tests CXX=afl-clang++
|
||||||
mv test/parse_afl_fuzzer fuzz-testing/fuzzer
|
mv tests/parse_afl_fuzzer fuzz-testing/fuzzer
|
||||||
find test/data/json_tests -size -5k -name *json | xargs -I{} cp "{}" fuzz-testing/testcases
|
find tests/data/json_tests -size -5k -name *json | xargs -I{} cp "{}" fuzz-testing/testcases
|
||||||
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
||||||
|
|
||||||
fuzz_testing_bson:
|
fuzz_testing_bson:
|
||||||
rm -fr fuzz-testing
|
rm -fr fuzz-testing
|
||||||
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
||||||
$(MAKE) parse_bson_fuzzer -C test CXX=afl-clang++
|
$(MAKE) parse_bson_fuzzer -C tests CXX=afl-clang++
|
||||||
mv test/parse_bson_fuzzer fuzz-testing/fuzzer
|
mv tests/parse_bson_fuzzer fuzz-testing/fuzzer
|
||||||
find test/data -size -5k -name *.bson | xargs -I{} cp "{}" fuzz-testing/testcases
|
find tests/data -size -5k -name *.bson | xargs -I{} cp "{}" fuzz-testing/testcases
|
||||||
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
||||||
|
|
||||||
fuzz_testing_cbor:
|
fuzz_testing_cbor:
|
||||||
rm -fr fuzz-testing
|
rm -fr fuzz-testing
|
||||||
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
||||||
$(MAKE) parse_cbor_fuzzer -C test CXX=afl-clang++
|
$(MAKE) parse_cbor_fuzzer -C tests CXX=afl-clang++
|
||||||
mv test/parse_cbor_fuzzer fuzz-testing/fuzzer
|
mv tests/parse_cbor_fuzzer fuzz-testing/fuzzer
|
||||||
find test/data -size -5k -name *.cbor | xargs -I{} cp "{}" fuzz-testing/testcases
|
find tests/data -size -5k -name *.cbor | xargs -I{} cp "{}" fuzz-testing/testcases
|
||||||
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
||||||
|
|
||||||
fuzz_testing_msgpack:
|
fuzz_testing_msgpack:
|
||||||
rm -fr fuzz-testing
|
rm -fr fuzz-testing
|
||||||
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
||||||
$(MAKE) parse_msgpack_fuzzer -C test CXX=afl-clang++
|
$(MAKE) parse_msgpack_fuzzer -C tests CXX=afl-clang++
|
||||||
mv test/parse_msgpack_fuzzer fuzz-testing/fuzzer
|
mv tests/parse_msgpack_fuzzer fuzz-testing/fuzzer
|
||||||
find test/data -size -5k -name *.msgpack | xargs -I{} cp "{}" fuzz-testing/testcases
|
find tests/data -size -5k -name *.msgpack | xargs -I{} cp "{}" fuzz-testing/testcases
|
||||||
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
||||||
|
|
||||||
fuzz_testing_ubjson:
|
fuzz_testing_ubjson:
|
||||||
rm -fr fuzz-testing
|
rm -fr fuzz-testing
|
||||||
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
||||||
$(MAKE) parse_ubjson_fuzzer -C test CXX=afl-clang++
|
$(MAKE) parse_ubjson_fuzzer -C tests CXX=afl-clang++
|
||||||
mv test/parse_ubjson_fuzzer fuzz-testing/fuzzer
|
mv tests/parse_ubjson_fuzzer fuzz-testing/fuzzer
|
||||||
find test/data -size -5k -name *.ubjson | xargs -I{} cp "{}" fuzz-testing/testcases
|
find tests/data -size -5k -name *.ubjson | xargs -I{} cp "{}" fuzz-testing/testcases
|
||||||
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
||||||
|
|
||||||
fuzzing-start:
|
fuzzing-start:
|
||||||
@ -159,11 +159,11 @@ pretty:
|
|||||||
--preserve-date \
|
--preserve-date \
|
||||||
--suffix=none \
|
--suffix=none \
|
||||||
--formatted \
|
--formatted \
|
||||||
$(SRCS) $(AMALGAMATED_FILE) test/src/*.cpp test/src/*.hpp test/benchmarks/src/benchmarks.cpp docs/examples/*.cpp
|
$(SRCS) $(AMALGAMATED_FILE) tests/src/*.cpp tests/src/*.hpp tests/benchmarks/src/benchmarks.cpp docs/examples/*.cpp
|
||||||
|
|
||||||
# call the Clang-Format on all source files
|
# call the Clang-Format on all source files
|
||||||
pretty_format:
|
pretty_format:
|
||||||
for FILE in $(SRCS) $(AMALGAMATED_FILE) test/src/*.cpp test/src/*.hpp benchmarks/src/benchmarks.cpp docs/examples/*.cpp; do echo $$FILE; clang-format -i $$FILE; done
|
for FILE in $(SRCS) $(AMALGAMATED_FILE) tests/src/*.cpp tests/src/*.hpp benchmarks/src/benchmarks.cpp docs/examples/*.cpp; do echo $$FILE; clang-format -i $$FILE; done
|
||||||
|
|
||||||
# create single header file
|
# create single header file
|
||||||
amalgamate: $(AMALGAMATED_FILE)
|
amalgamate: $(AMALGAMATED_FILE)
|
||||||
@ -233,7 +233,7 @@ release: include.zip json.tar.xz
|
|||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
clean:
|
clean:
|
||||||
rm -fr fuzz fuzz-testing *.dSYM test/*.dSYM
|
rm -fr fuzz fuzz-testing *.dSYM tests/*.dSYM
|
||||||
rm -fr benchmarks/files/numbers/*.json
|
rm -fr benchmarks/files/numbers/*.json
|
||||||
rm -fr cmake-build-benchmarks fuzz-testing cmake-build-pvs-studio release_files
|
rm -fr cmake-build-benchmarks fuzz-testing cmake-build-pvs-studio release_files
|
||||||
$(MAKE) clean -Cdocs
|
$(MAKE) clean -Cdocs
|
||||||
|
|||||||
@ -54,7 +54,7 @@ There are myriads of [JSON](https://json.org) libraries out there, and each may
|
|||||||
|
|
||||||
- **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp). That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings.
|
- **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp). That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings.
|
||||||
|
|
||||||
- **Serious testing**. Our class is heavily [unit-tested](https://github.com/nlohmann/json/tree/develop/test/src) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](https://valgrind.org) and the [Clang Sanitizers](https://clang.llvm.org/docs/index.html) that there are no memory leaks. [Google OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/json) additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the [Core Infrastructure Initiative (CII) best practices](https://bestpractices.coreinfrastructure.org/projects/289).
|
- **Serious testing**. Our class is heavily [unit-tested](https://github.com/nlohmann/json/tree/develop/tests/src) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](https://valgrind.org) and the [Clang Sanitizers](https://clang.llvm.org/docs/index.html) that there are no memory leaks. [Google OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/json) additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the [Core Infrastructure Initiative (CII) best practices](https://bestpractices.coreinfrastructure.org/projects/289).
|
||||||
|
|
||||||
Other aspects were not so important to us:
|
Other aspects were not so important to us:
|
||||||
|
|
||||||
@ -857,7 +857,7 @@ namespace nlohmann {
|
|||||||
|
|
||||||
#### Can I write my own serializer? (Advanced use)
|
#### Can I write my own serializer? (Advanced use)
|
||||||
|
|
||||||
Yes. You might want to take a look at [`unit-udt.cpp`](https://github.com/nlohmann/json/blob/develop/test/src/unit-udt.cpp) in the test suite, to see a few examples.
|
Yes. You might want to take a look at [`unit-udt.cpp`](https://github.com/nlohmann/json/blob/develop/tests/src/unit-udt.cpp) in the test suite, to see a few examples.
|
||||||
|
|
||||||
If you write your own serializer, you'll need to do a few things:
|
If you write your own serializer, you'll need to do a few things:
|
||||||
|
|
||||||
|
|||||||
@ -542,9 +542,9 @@ set(ASTYLE_FLAGS --style=allman --indent=spaces=4 --indent-modifiers --indent-sw
|
|||||||
|
|
||||||
file(GLOB_RECURSE INDENT_FILES
|
file(GLOB_RECURSE INDENT_FILES
|
||||||
${PROJECT_SOURCE_DIR}/include/nlohmann/*.hpp
|
${PROJECT_SOURCE_DIR}/include/nlohmann/*.hpp
|
||||||
${PROJECT_SOURCE_DIR}/test/src/*.cpp
|
${PROJECT_SOURCE_DIR}/tests/src/*.cpp
|
||||||
${PROJECT_SOURCE_DIR}/test/src/*.hpp
|
${PROJECT_SOURCE_DIR}/tests/src/*.hpp
|
||||||
${PROJECT_SOURCE_DIR}/test/benchmarks/src/benchmarks.cpp
|
${PROJECT_SOURCE_DIR}/tests/benchmarks/src/benchmarks.cpp
|
||||||
${PROJECT_SOURCE_DIR}/docs/examples/*.cpp
|
${PROJECT_SOURCE_DIR}/docs/examples/*.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 166 KiB |
|
Before Width: | Height: | Size: 192 KiB After Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 182 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |