🔨 moved third-party code into separate folder
This commit is contained in:
parent
6e8791912f
commit
ad241a2260
160 changed files with 27 additions and 21 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -20,4 +20,4 @@ cmake-build-debug
|
||||||
|
|
||||||
|
|
||||||
test/test-*
|
test/test-*
|
||||||
test/fuzz_test/Fuzzer/.svn
|
.svn
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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 $@
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << json::parse(data, data + size);
|
s << json::parse(data, data + size);
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
auto j = json::parse(s.str());
|
auto j = json::parse(s.str());
|
||||||
std::stringstream s2;
|
std::stringstream s2;
|
||||||
s2 << j;
|
s2 << j;
|
||||||
assert(s.str() == s2.str());
|
assert(s.str() == s2.str());
|
||||||
assert(j == json::parse(s.str()));
|
assert(j == json::parse(s.str()));
|
||||||
} catch (const std::invalid_argument&) {
|
}
|
||||||
|
catch (const std::invalid_argument&)
|
||||||
|
{
|
||||||
assert(0);
|
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
Loading…
Reference in a new issue