| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- enable_testing()
- # MUST do this before including IDNA
- # because it will otherwise poison GTest with BUILD_GMOCK=OFF
- find_package(GTest CONFIG REQUIRED COMPONENTS gtest gmock)
- find_package(jsoncpp REQUIRED)
- find_package(CURL REQUIRED)
- # ICU Components Reference:
- # https://cmake.org/cmake/help/latest/module/FindICU.html
- # ICU components = data, i18n, io, le, lx, test, tu and uc.
- find_package(ICU 77.1 COMPONENTS uc i18n)
- FetchContent_Declare(
- json_schema_test_suite
- GIT_REPOSITORY https://github.com/json-schema-org/JSON-Schema-Test-Suite.git
- GIT_TAG Test-JSON-Schema-Acceptance-1.037
- )
- FetchContent_MakeAvailable(json_schema_test_suite)
- include(GoogleTest)
- add_executable(annotation_test annotation_test.cxx)
- target_link_libraries(annotation_test GTest::gtest GTest::gmock jsoncpp_lib)
- gtest_discover_tests(annotation_test)
- add_executable(extension_test extension_test.cxx)
- target_link_libraries(extension_test GTest::gtest GTest::gmock jsoncpp_lib)
- gtest_discover_tests(extension_test)
- add_executable(selfvalidate_test selfvalidate_test.cxx)
- target_compile_definitions(selfvalidate_test PUBLIC JVALIDATE_USE_EXCEPTIONS)
- if (${json_schema_test_suite_POPULATED})
- target_compile_definitions(selfvalidate_test
- PUBLIC
- JVALIDATE_JSON_SCHEMA_TEST_SUITE_DIR="${json_schema_test_suite_SOURCE_DIR}"
- )
- endif()
- target_link_libraries(selfvalidate_test GTest::gtest GTest::gmock jsoncpp_lib CURL::libcurl)
- if (ICU_FOUND)
- target_link_libraries(annotation_test ICU::uc ICU::i18n)
- target_link_libraries(extension_test ICU::uc ICU::i18n)
- target_link_libraries(selfvalidate_test ICU::uc ICU::i18n)
- endif()
- string(
- JOIN ":"
- SelfValidateTest_Unsupported
- "*optional_content"
- "*optional_*ecmascript_regex"
- "*optional_zeroTerminatedFloats"
- "*optional_format*"
- )
- set(SelfValidateTest_Unsupported_Suites "")
- set(SelfValidateTest_Unsupported_Cases "*leap second")
- if (ICU_FOUND)
- target_compile_definitions(selfvalidate_test PUBLIC JVALIDATE_HAS_ICU=1)
- target_link_libraries(annotation_test ICU::uc ICU::i18n)
- target_link_libraries(extension_test ICU::uc ICU::i18n)
- target_link_libraries(selfvalidate_test ICU::uc ICU::i18n)
- else()
- target_compile_definitions(selfvalidate_test PUBLIC JVALIDATE_HAS_ICU=0)
- string(
- APPEND SelfValidateTest_Unsupported
- ":*optional_non_bmp_regex"
- )
- endif()
- gtest_discover_tests(selfvalidate_test
- EXTRA_ARGS --json_suite_filter=-${SelfValidateTest_Unsupported_Suites}
- --json_case_filter=-${SelfValidateTest_Unsupported_Cases}
- TEST_FILTER -${SelfValidateTest_Unsupported})
|