mirror of
https://github.com/json-c/json-c.git
synced 2026-03-23 23:19:06 +08:00
Essentially, this change adds the test cases from this repo: https://github.com/json-patch/json-patch-tests Specifically: https://github.com/json-patch/json-patch-tests/blob/master/spec_tests.json https://github.com/json-patch/json-patch-tests/blob/master/tests.json The files were taken at the date of this commit, at git hash ea3af85790cb72893d0676597814b7532019c24e Some tests may not have an 'expected' or 'error' field. Those are ignored. One test was disabled manually via "disabled_in_json_c", because it tries an impossible test, i.e. to add 2 "op" fields in the same patch entry, something which is impossible in a JSON object. For the 'error' cases, right now we only test that an error happens. Later, we can extend this to check the error codes. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
65 lines
1.6 KiB
CMake
65 lines
1.6 KiB
CMake
cmake_minimum_required(VERSION 3.1)
|
|
add_executable(test1Formatted test1.c parse_flags.c parse_flags.h)
|
|
target_compile_definitions(test1Formatted PRIVATE TEST_FORMATTED=1)
|
|
target_link_libraries(test1Formatted PRIVATE ${PROJECT_NAME})
|
|
|
|
add_executable(test2Formatted test2.c parse_flags.c parse_flags.h)
|
|
target_compile_definitions(test2Formatted PRIVATE TEST_FORMATTED=1)
|
|
target_link_libraries(test2Formatted PRIVATE ${PROJECT_NAME})
|
|
|
|
# https://cmake.org/cmake/help/v3.0/command/add_test.html
|
|
# https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
|
|
|
|
include_directories(PUBLIC ${CMAKE_SOURCE_DIR})
|
|
|
|
set(ALL_TEST_NAMES
|
|
test1
|
|
test2
|
|
test4
|
|
testReplaceExisting
|
|
test_cast
|
|
test_charcase
|
|
test_compare
|
|
test_deep_copy
|
|
test_double_serializer
|
|
test_float
|
|
test_int_add
|
|
test_int_get
|
|
test_locale
|
|
test_null
|
|
test_parse
|
|
test_parse_int64
|
|
test_printbuf
|
|
test_set_serializer
|
|
test_set_value
|
|
test_strerror
|
|
test_util_file
|
|
test_visit
|
|
test_object_iterator)
|
|
|
|
if (NOT DISABLE_JSON_POINTER)
|
|
set(ALL_TEST_NAMES ${ALL_TEST_NAMES} test_json_pointer)
|
|
if (NOT DISABLE_JSON_PATCH)
|
|
set(ALL_TEST_NAMES ${ALL_TEST_NAMES} test_json_patch)
|
|
endif()
|
|
endif()
|
|
|
|
foreach(TESTNAME ${ALL_TEST_NAMES})
|
|
|
|
add_executable(${TESTNAME} ${TESTNAME}.c)
|
|
add_test(NAME ${TESTNAME} COMMAND ${PROJECT_SOURCE_DIR}/tests/${TESTNAME}.test)
|
|
|
|
# XXX using the non-target_ versions of these doesn't work :(
|
|
target_include_directories(
|
|
${TESTNAME}
|
|
PUBLIC
|
|
${CMAKE_CURRENT_LIST_DIR}
|
|
)
|
|
target_link_libraries(
|
|
${TESTNAME}
|
|
PRIVATE
|
|
${PROJECT_NAME}
|
|
)
|
|
|
|
endforeach(TESTNAME)
|