Reorganize directories (#3462)

* 🚚 move files
* 🚚 rename doc folder to docs
* 🚚 rename test folder to tests
pull/3456/head
Niels Lohmann 5 months ago committed by GitHub
parent 5352856f04
commit b21c345179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      .github/CODE_OF_CONDUCT.md
  2. 2
      .github/external_ci/.drone.yml
  3. 0
      .github/external_ci/appveyor.yml
  4. 14
      .gitignore
  5. 2
      CMakeLists.txt
  6. 44
      Makefile
  7. 12
      README.md
  8. 18
      cmake/ci.cmake
  9. 0
      docs/Makefile
  10. 2
      docs/README.md
  11. 0
      docs/avatars.png
  12. 0
      docs/docset/Info.plist
  13. 0
      docs/docset/Makefile
  14. 0
      docs/docset/README.md
  15. 0
      docs/docset/docSet.sql
  16. 0
      docs/docset/docset.json
  17. 0
      docs/docset/icon.png
  18. 0
      docs/docset/icon@2x.png
  19. 0
      docs/examples/README.cpp
  20. 0
      docs/examples/README.output
  21. 0
      docs/examples/accept__string.cpp
  22. 0
      docs/examples/accept__string.output
  23. 0
      docs/examples/array.cpp
  24. 0
      docs/examples/array.output
  25. 0
      docs/examples/array_t.cpp
  26. 0
      docs/examples/array_t.output
  27. 0
      docs/examples/at__object_t_key_type.cpp
  28. 0
      docs/examples/at__object_t_key_type.output
  29. 0
      docs/examples/at__object_t_key_type_const.cpp
  30. 0
      docs/examples/at__object_t_key_type_const.output
  31. 0
      docs/examples/at__size_type.cpp
  32. 0
      docs/examples/at__size_type.output
  33. 0
      docs/examples/at__size_type_const.cpp
  34. 0
      docs/examples/at__size_type_const.output
  35. 0
      docs/examples/at_json_pointer.cpp
  36. 0
      docs/examples/at_json_pointer.output
  37. 0
      docs/examples/at_json_pointer_const.cpp
  38. 0
      docs/examples/at_json_pointer_const.output
  39. 0
      docs/examples/back.cpp
  40. 0
      docs/examples/back.output
  41. 0
      docs/examples/basic_json__CompatibleType.cpp
  42. 0
      docs/examples/basic_json__CompatibleType.output
  43. 0
      docs/examples/basic_json__InputIt_InputIt.cpp
  44. 0
      docs/examples/basic_json__InputIt_InputIt.output
  45. 0
      docs/examples/basic_json__basic_json.cpp
  46. 0
      docs/examples/basic_json__basic_json.output
  47. 0
      docs/examples/basic_json__copyassignment.cpp
  48. 0
      docs/examples/basic_json__copyassignment.output
  49. 0
      docs/examples/basic_json__list_init_t.cpp
  50. 0
      docs/examples/basic_json__list_init_t.output
  51. 0
      docs/examples/basic_json__moveconstructor.cpp
  52. 0
      docs/examples/basic_json__moveconstructor.output
  53. 0
      docs/examples/basic_json__nullptr_t.cpp
  54. 0
      docs/examples/basic_json__nullptr_t.output
  55. 0
      docs/examples/basic_json__size_type_basic_json.cpp
  56. 0
      docs/examples/basic_json__size_type_basic_json.output
  57. 0
      docs/examples/basic_json__value.cpp
  58. 0
      docs/examples/basic_json__value.output
  59. 0
      docs/examples/basic_json__value_ptr.cpp
  60. 0
      docs/examples/basic_json__value_ptr.output
  61. 0
      docs/examples/basic_json__value_t.cpp
  62. 0
      docs/examples/basic_json__value_t.output
  63. 0
      docs/examples/begin.cpp
  64. 0
      docs/examples/begin.output
  65. 0
      docs/examples/binary.cpp
  66. 0
      docs/examples/binary.output
  67. 0
      docs/examples/binary_t.cpp
  68. 0
      docs/examples/binary_t.output
  69. 0
      docs/examples/boolean_t.cpp
  70. 0
      docs/examples/boolean_t.output
  71. 0
      docs/examples/cbegin.cpp
  72. 0
      docs/examples/cbegin.output
  73. 0
      docs/examples/cend.cpp
  74. 0
      docs/examples/cend.output
  75. 0
      docs/examples/clear.cpp
  76. 0
      docs/examples/clear.output
  77. 0
      docs/examples/contains.cpp
  78. 0
      docs/examples/contains.output
  79. 0
      docs/examples/contains_json_pointer.cpp
  80. 0
      docs/examples/contains_json_pointer.output
  81. 0
      docs/examples/count.cpp
  82. 0
      docs/examples/count.output
  83. 0
      docs/examples/crbegin.cpp
  84. 0
      docs/examples/crbegin.output
  85. 0
      docs/examples/crend.cpp
  86. 0
      docs/examples/crend.output
  87. 0
      docs/examples/diagnostics_extended.cpp
  88. 0
      docs/examples/diagnostics_extended.output
  89. 0
      docs/examples/diagnostics_standard.cpp
  90. 0
      docs/examples/diagnostics_standard.output
  91. 0
      docs/examples/diff.cpp
  92. 0
      docs/examples/diff.output
  93. 0
      docs/examples/dump.cpp
  94. 0
      docs/examples/dump.output
  95. 0
      docs/examples/emplace.cpp
  96. 0
      docs/examples/emplace.output
  97. 0
      docs/examples/emplace_back.cpp
  98. 0
      docs/examples/emplace_back.output
  99. 0
      docs/examples/empty.cpp
  100. 0
      docs/examples/empty.output
  101. Some files were not shown because too many files have changed in this diff Show More

@ -18,5 +18,5 @@ steps:
- cd build
- ../cmake-3.20.2/bin/cmake .. -DJSON_FastTests=ON
- make -j10
- cd test
- cd tests
- ../../cmake-3.20.2/bin/ctest -j10

14
.gitignore vendored

@ -12,10 +12,10 @@
/.vs
/doc/mkdocs/docs/examples/
/doc/mkdocs/docs/__pycache__/
/doc/mkdocs/site/
/doc/mkdocs/venv/
/doc/docset/JSON_for_Modern_C++.docset/
/doc/docset/JSON_for_Modern_C++.tgz
/doc/mkdocs/docs/images/json.gif
/docs/mkdocs/docs/examples/
/docs/mkdocs/docs/__pycache__/
/docs/mkdocs/site/
/docs/mkdocs/venv/
/docs/docset/JSON_for_Modern_C++.docset/
/docs/docset/JSON_for_Modern_C++.tgz
/docs/mkdocs/docs/images/json.gif

@ -136,7 +136,7 @@ CONFIGURE_FILE(
if (JSON_BuildTests)
include(CTest)
enable_testing()
add_subdirectory(test)
add_subdirectory(tests)
endif()
##

@ -45,7 +45,7 @@ all:
# compile example files and check output
doctest:
$(MAKE) check_output -C doc
$(MAKE) check_output -C docs
##########################################################################
@ -55,7 +55,7 @@ doctest:
run_benchmarks:
rm -fr cmake-build-benchmarks
mkdir cmake-build-benchmarks
cd cmake-build-benchmarks ; cmake ../benchmarks -GNinja -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=On
cd cmake-build-benchmarks ; cmake ../tests/benchmarks -GNinja -DCMAKE_BUILD_TYPE=Release
cd cmake-build-benchmarks ; ninja
cd cmake-build-benchmarks ; ./json_benchmarks
@ -68,41 +68,41 @@ run_benchmarks:
fuzz_testing:
rm -fr fuzz-testing
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
$(MAKE) parse_afl_fuzzer -C test CXX=afl-clang++
mv test/parse_afl_fuzzer fuzz-testing/fuzzer
find test/data/json_tests -size -5k -name *json | xargs -I{} cp "{}" fuzz-testing/testcases
$(MAKE) parse_afl_fuzzer -C tests CXX=afl-clang++
mv tests/parse_afl_fuzzer fuzz-testing/fuzzer
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"
fuzz_testing_bson:
rm -fr fuzz-testing
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
$(MAKE) parse_bson_fuzzer -C test CXX=afl-clang++
mv test/parse_bson_fuzzer fuzz-testing/fuzzer
find test/data -size -5k -name *.bson | xargs -I{} cp "{}" fuzz-testing/testcases
$(MAKE) parse_bson_fuzzer -C tests CXX=afl-clang++
mv tests/parse_bson_fuzzer fuzz-testing/fuzzer
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"
fuzz_testing_cbor:
rm -fr fuzz-testing
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
$(MAKE) parse_cbor_fuzzer -C test CXX=afl-clang++
mv test/parse_cbor_fuzzer fuzz-testing/fuzzer
find test/data -size -5k -name *.cbor | xargs -I{} cp "{}" fuzz-testing/testcases
$(MAKE) parse_cbor_fuzzer -C tests CXX=afl-clang++
mv tests/parse_cbor_fuzzer fuzz-testing/fuzzer
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"
fuzz_testing_msgpack:
rm -fr fuzz-testing
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
$(MAKE) parse_msgpack_fuzzer -C test CXX=afl-clang++
mv test/parse_msgpack_fuzzer fuzz-testing/fuzzer
find test/data -size -5k -name *.msgpack | xargs -I{} cp "{}" fuzz-testing/testcases
$(MAKE) parse_msgpack_fuzzer -C tests CXX=afl-clang++
mv tests/parse_msgpack_fuzzer fuzz-testing/fuzzer
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"
fuzz_testing_ubjson:
rm -fr fuzz-testing
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
$(MAKE) parse_ubjson_fuzzer -C test CXX=afl-clang++
mv test/parse_ubjson_fuzzer fuzz-testing/fuzzer
find test/data -size -5k -name *.ubjson | xargs -I{} cp "{}" fuzz-testing/testcases
$(MAKE) parse_ubjson_fuzzer -C tests CXX=afl-clang++
mv tests/parse_ubjson_fuzzer fuzz-testing/fuzzer
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"
fuzzing-start:
@ -159,18 +159,18 @@ pretty:
--preserve-date \
--suffix=none \
--formatted \
$(SRCS) $(AMALGAMATED_FILE) test/src/*.cpp test/src/*.hpp benchmarks/src/benchmarks.cpp doc/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
pretty_format:
for FILE in $(SRCS) $(AMALGAMATED_FILE) test/src/*.cpp test/src/*.hpp benchmarks/src/benchmarks.cpp doc/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
amalgamate: $(AMALGAMATED_FILE)
# call the amalgamation tool and pretty print
$(AMALGAMATED_FILE): $(SRCS)
third_party/amalgamate/amalgamate.py -c third_party/amalgamate/config.json -s . --verbose=yes
tools/amalgamate/amalgamate.py -c tools/amalgamate/config.json -s . --verbose=yes
$(MAKE) pretty
# check if file single_include/nlohmann/json.hpp has been amalgamated from the nlohmann sources
@ -233,10 +233,10 @@ release: include.zip json.tar.xz
# clean up
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 cmake-build-benchmarks fuzz-testing cmake-build-pvs-studio release_files
$(MAKE) clean -Cdoc
$(MAKE) clean -Cdocs
##########################################################################

@ -1,4 +1,4 @@
[![JSON for Modern C++](https://raw.githubusercontent.com/nlohmann/json/master/doc/json.gif)](https://github.com/nlohmann/json/releases)
[![JSON for Modern C++](docs/json.gif)](https://github.com/nlohmann/json/releases)
[![Build Status](https://ci.appveyor.com/api/projects/status/1acb366xfyg3qybk/branch/develop?svg=true)](https://ci.appveyor.com/project/nlohmann/json)
[![Ubuntu](https://github.com/nlohmann/json/workflows/Ubuntu/badge.svg)](https://github.com/nlohmann/json/actions?query=workflow%3AUbuntu)
@ -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.
- **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:
@ -83,7 +83,7 @@ Thanks everyone!
:question: If you have a **question**, please check if it is already answered in the [**FAQ**](https://json.nlohmann.me/home/faq/) or the [**Q&A**](https://github.com/nlohmann/json/discussions/categories/q-a) section. If not, please [**ask a new question**](https://github.com/nlohmann/json/discussions/new) there.
:books: If you want to **learn more** about how to use the library, check out the rest of the [**README**](#examples), have a look at [**code examples**](https://github.com/nlohmann/json/tree/develop/doc/examples), or browse through the [**help pages**](https://json.nlohmann.me).
:books: If you want to **learn more** about how to use the library, check out the rest of the [**README**](#examples), have a look at [**code examples**](https://github.com/nlohmann/json/tree/develop/docs/examples), or browse through the [**help pages**](https://json.nlohmann.me).
:construction: If you want to understand the **API** better, check out the [**API Reference**](https://json.nlohmann.me/api/basic_json/).
@ -93,7 +93,7 @@ There is also a [**docset**](https://github.com/Kapeli/Dash-User-Contributions/t
## Examples
Beside the examples below, you may want to check the [documentation](https://json.nlohmann.me/) where each function contains a separate code example (e.g., check out [`emplace()`](https://json.nlohmann.me/api/basic_json/emplace/)). All [example files](https://github.com/nlohmann/json/tree/develop/doc/examples) can be compiled and executed on their own (e.g., file [emplace.cpp](https://github.com/nlohmann/json/blob/develop/doc/examples/emplace.cpp)).
Beside the examples below, you may want to check the [documentation](https://json.nlohmann.me/) where each function contains a separate code example (e.g., check out [`emplace()`](https://json.nlohmann.me/api/basic_json/emplace/)). All [example files](https://github.com/nlohmann/json/tree/develop/docs/examples) can be compiled and executed on their own (e.g., file [emplace.cpp](https://github.com/nlohmann/json/blob/develop/docs/examples/emplace.cpp)).
### JSON as first-class data type
@ -857,7 +857,7 @@ namespace nlohmann {
#### 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:
@ -1329,7 +1329,7 @@ Only if your request would contain confidential information, please [send me an
I deeply appreciate the help of the following people.
<img src="https://raw.githubusercontent.com/nlohmann/json/develop/doc/avatars.png" align="right">
<img src="https://raw.githubusercontent.com/nlohmann/json/develop/docs/avatars.png" align="right">
- [Teemperor](https://github.com/Teemperor) implemented CMake support and lcov integration, realized escape and Unicode handling in the string parser, and fixed the JSON serialization.
- [elliotgoodrich](https://github.com/elliotgoodrich) fixed an issue with double deletion in the iterator classes.

@ -512,7 +512,7 @@ add_custom_target(ci_test_coverage
COMMAND ${LCOV_TOOL} --directory . --capture --output-file json.info --rc lcov_branch_coverage=1
COMMAND ${LCOV_TOOL} -e json.info ${SRC_FILES} --output-file json.info.filtered --rc lcov_branch_coverage=1
COMMAND ${CMAKE_SOURCE_DIR}/test/thirdparty/imapdl/filterbr.py json.info.filtered > json.info.filtered.noexcept
COMMAND ${CMAKE_SOURCE_DIR}/tests/thirdparty/imapdl/filterbr.py json.info.filtered > json.info.filtered.noexcept
COMMAND genhtml --title "JSON for Modern C++" --legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered.noexcept
COMMENT "Compile and test with coverage"
@ -542,16 +542,16 @@ set(ASTYLE_FLAGS --style=allman --indent=spaces=4 --indent-modifiers --indent-sw
file(GLOB_RECURSE INDENT_FILES
${PROJECT_SOURCE_DIR}/include/nlohmann/*.hpp
${PROJECT_SOURCE_DIR}/test/src/*.cpp
${PROJECT_SOURCE_DIR}/test/src/*.hpp
${PROJECT_SOURCE_DIR}/benchmarks/src/benchmarks.cpp
${PROJECT_SOURCE_DIR}/doc/examples/*.cpp
${PROJECT_SOURCE_DIR}/tests/src/*.cpp
${PROJECT_SOURCE_DIR}/tests/src/*.hpp
${PROJECT_SOURCE_DIR}/tests/benchmarks/src/benchmarks.cpp
${PROJECT_SOURCE_DIR}/docs/examples/*.cpp
)
add_custom_target(ci_test_amalgamation
COMMAND rm -fr ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp~
COMMAND cp ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp~
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/third_party/amalgamate/amalgamate.py -c ${PROJECT_SOURCE_DIR}/third_party/amalgamate/config.json -s .
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/amalgamate/amalgamate.py -c ${PROJECT_SOURCE_DIR}/tools/amalgamate/config.json -s .
COMMAND ${ASTYLE_TOOL} ${ASTYLE_FLAGS} --suffix=none --quiet ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp
COMMAND diff ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp~ ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp
@ -559,7 +559,7 @@ add_custom_target(ci_test_amalgamation
COMMAND cd ${PROJECT_SOURCE_DIR} && for FILE in `find . -name '*.orig'`\; do false \; done
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Check amalagamation and indentation"
COMMENT "Check amalgamation and indentation"
)
###############################################################################
@ -605,7 +605,7 @@ add_custom_target(ci_cppcheck
###############################################################################
add_custom_target(ci_cpplint
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/third_party/cpplint/cpplint.py --filter=-whitespace,-legal,-runtime/references,-runtime/explicit,-runtime/indentation_namespace,-readability/casting,-readability/nolint --quiet --recursive ${SRC_FILES}
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/cpplint/cpplint.py --filter=-whitespace,-legal,-runtime/references,-runtime/explicit,-runtime/indentation_namespace,-readability/casting,-readability/nolint --quiet --recursive ${SRC_FILES}
COMMENT "Check code with cpplint"
)
@ -873,7 +873,7 @@ add_custom_target(ci_cuda_example
COMMAND ${CMAKE_COMMAND}
-DCMAKE_BUILD_TYPE=Debug -GNinja
-DCMAKE_CUDA_HOST_COMPILER=g++-8
-S${PROJECT_SOURCE_DIR}/test/cuda_example -B${PROJECT_BINARY_DIR}/build_cuda_example
-S${PROJECT_SOURCE_DIR}/tests/cuda_example -B${PROJECT_BINARY_DIR}/build_cuda_example
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_cuda_example
)

@ -13,7 +13,7 @@ If you want to see the documentation for a specific tag or commit hash, you can
git clone https://github.com/nlohmann/json.git
cd json
git checkout v3.10.2
make install_venv serve -C doc/mkdocs
make install_venv serve -C docs/mkdocs
```
Open URL <http://127.0.0.1:8000/> in your browser. Replace from any URL from the source code `https://json.nlohmann.me`

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Before

Width:  |  Height:  |  Size: 700 B

After

Width:  |  Height:  |  Size: 700 B

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save