🔨 moved third-party code into separate folder

pull/410/head
Niels Lohmann 2016-12-22 09:35:53 +01:00
parent 6e8791912f
commit ad241a2260
160 changed files with 27 additions and 21 deletions

2
.gitignore vendored
View File

@ -20,4 +20,4 @@ cmake-build-debug
test/test-* test/test-*
test/fuzz_test/Fuzzer/.svn .svn

View File

@ -1,7 +1,7 @@
# The unit test executable. # The unit test executable.
set(JSON_UNITTEST_TARGET_NAME "json_unit") set(JSON_UNITTEST_TARGET_NAME "json_unit")
add_executable(${JSON_UNITTEST_TARGET_NAME} add_executable(${JSON_UNITTEST_TARGET_NAME}
"src/catch.hpp" "thirdparty/catch/catch.hpp"
"src/unit.cpp" "src/unit.cpp"
"src/unit-algorithms.cpp" "src/unit-algorithms.cpp"
"src/unit-allocator.cpp" "src/unit-allocator.cpp"
@ -44,7 +44,7 @@ set_target_properties(${JSON_UNITTEST_TARGET_NAME} PROPERTIES
COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>" COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
) )
target_include_directories(${JSON_UNITTEST_TARGET_NAME} PRIVATE "src") target_include_directories(${JSON_UNITTEST_TARGET_NAME} PRIVATE "src" "thirdparty/catch")
target_link_libraries(${JSON_UNITTEST_TARGET_NAME} ${JSON_TARGET_NAME}) target_link_libraries(${JSON_UNITTEST_TARGET_NAME} ${JSON_TARGET_NAME})
add_test(NAME "${JSON_UNITTEST_TARGET_NAME}_default" add_test(NAME "${JSON_UNITTEST_TARGET_NAME}_default"

View File

@ -4,7 +4,7 @@
# additional flags # additional flags
CXXFLAGS += -std=c++11 -Wall -Wextra -pedantic -Weffc++ -Wcast-align -Wcast-qual -Wno-ctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch -Wundef -Wno-unused -Wnon-virtual-dtor -Wreorder -Wdeprecated -Wno-float-equal CXXFLAGS += -std=c++11 -Wall -Wextra -pedantic -Weffc++ -Wcast-align -Wcast-qual -Wno-ctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch -Wundef -Wno-unused -Wnon-virtual-dtor -Wreorder -Wdeprecated -Wno-float-equal
CPPFLAGS += -I ../src -I . CPPFLAGS += -I ../src -I . -I thirdparty/catch
SOURCES = src/unit.cpp \ SOURCES = src/unit.cpp \
src/unit-algorithms.cpp \ src/unit-algorithms.cpp \
@ -57,11 +57,11 @@ clean:
# single test file # single test file
############################################################################## ##############################################################################
json_unit: $(OBJECTS) ../src/json.hpp src/catch.hpp json_unit: $(OBJECTS) ../src/json.hpp thirdparty/catch/catch.hpp
@echo "[CXXLD] $@" @echo "[CXXLD] $@"
@$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ @$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@
%.o: %.cpp ../src/json.hpp src/catch.hpp %.o: %.cpp ../src/json.hpp thirdparty/catch/catch.hpp
@echo "[CXX] $@" @echo "[CXX] $@"
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ @$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
@ -70,7 +70,7 @@ json_unit: $(OBJECTS) ../src/json.hpp src/catch.hpp
# individual test cases # individual test cases
############################################################################## ##############################################################################
test-%: src/unit-%.cpp ../src/json.hpp src/catch.hpp test-%: src/unit-%.cpp ../src/json.hpp thirdparty/catch/catch.hpp
@echo "[CXXLD] $@" @echo "[CXXLD] $@"
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -DCATCH_CONFIG_MAIN $< -o $@ @$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -DCATCH_CONFIG_MAIN $< -o $@

View File

@ -18,19 +18,25 @@
using json = nlohmann::json; using json = nlohmann::json;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
try { {
std::stringstream s; try
s << json::parse(data, data + size); {
try { std::stringstream s;
auto j = json::parse(s.str()); s << json::parse(data, data + size);
std::stringstream s2; try
s2 << j; {
assert(s.str() == s2.str()); auto j = json::parse(s.str());
assert(j == json::parse(s.str())); std::stringstream s2;
} catch (const std::invalid_argument&) { s2 << j;
assert(0); assert(s.str() == s2.str());
assert(j == json::parse(s.str()));
}
catch (const std::invalid_argument&)
{
assert(0);
}
} }
} catch (const std::invalid_argument&) { } catch (const std::invalid_argument&) { }
return 0; return 0;
} }

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