diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f283929..2bf44068 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,10 +6,13 @@ project(espeak-ng HOMEPAGE_URL "https://github.com/espeak-ng/espeak-ng" ) +include(CTest) + include(cmake/deps.cmake) include(cmake/config.cmake) add_subdirectory(src) include(cmake/data.cmake) +add_subdirectory(tests) option(BUILD_SHARED_LIBS "Build shared libraries" OFF) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..bc398e51 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,73 @@ +include(CTest) + +list(APPEND _binary_tests) + +macro(compiled_test _test_name) + add_executable(test_${_test_name} + $ + ${_test_name}.c + ) + target_link_libraries(test_${_test_name} PRIVATE + $ + ) + target_include_directories( + test_${_test_name} PRIVATE + $ + $/include/compat + $ + $ + ) + add_dependencies(test_${_test_name} data) + add_test( + NAME ${_test_name} + COMMAND ${ESPEAK_RUN_ENV} $ + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.. + ) + list(APPEND _binary_tests test_${_test_name}) +endmacro(compiled_test) + +find_program(SHELL bash) + +macro(shell_test _test_name) + add_test( + NAME ${_test_name} + COMMAND ${ESPEAK_RUN_ENV} ESPEAK_BIN=$ ${SHELL} ${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.. + ) +endmacro(shell_test) + +compiled_test(api) +compiled_test(encoding) +compiled_test(ieee80) +compiled_test(readclause) + +if (SHELL AND UNIX) + +# shell_test(bom) +# shell_test(non-executable-files-with-executable-bit) + +shell_test(cmd_options) +shell_test(dictionary) +shell_test(language-numbers-cardinal) +shell_test(language-numbers-ordinal) +# shell_test(language-phonemes) +shell_test(language-pronunciation) +shell_test(language-replace) +shell_test(ssml) +shell_test(translate) +shell_test(variants) +shell_test(voices) + +# shell_test(windows-data) +# shell_test(windows-installer) + +if (USE_KLATT) + shell_test(klatt) +endif() +if (USE_MBROLA) + shell_test(mbrola) +endif() + +endif() + +add_custom_target(tests DEPENDS ${_binary_tests})