diff --git a/catch2 b/catch2 index c359076..53d0d91 160000 --- a/catch2 +++ b/catch2 @@ -1 +1 @@ -Subproject commit c359076e8ad5d8be45a56dee013f414a5485050b +Subproject commit 53d0d913a422d356b23dd927547febdf69ee9081 diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 62b31b5..8166e8e 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -142,3 +142,21 @@ if(NOT CLAP_PLUGINS_HEADLESS AND NOT CLAP_PLUGINS_EMBED_QML) DESTINATION "lib/clap-plugins" PATTERN CMakeLists.txt EXCLUDE) endif() + +# CLAP_BUILD_TESTS is inherited from clap +if (${CLAP_BUILD_TESTS}) + enable_testing() + find_package(Catch2 3 QUIET) + + if (Catch2_FOUND) + add_executable(clap-plugins-tests EXCLUDE_FROM_ALL + tests/value-type-tests.cc) + set_target_properties(clap-plugins-tests PROPERTIES CXX_STANDARD 11) + target_link_libraries(clap-plugins-tests clap-helpers clap Catch2::Catch2WithMain) + target_compile_definitions(clap-plugins-tests PUBLIC -DCATCH_CONFIG_PREFIX_ALL) + add_test(NAME test-clap-plugins COMMAND clap-plugins-tests) + add_dependencies(clap-tests clap-plugins-tests) + else() + message(STATUS "Catch2 >= 3 isn't found -> disable clap-plugins unit tests") + endif() +endif() \ No newline at end of file diff --git a/plugins/tests/value-type-tests.cc b/plugins/tests/value-type-tests.cc new file mode 100644 index 0000000..8936898 --- /dev/null +++ b/plugins/tests/value-type-tests.cc @@ -0,0 +1,13 @@ +#include "../value-types/decibel-value-type.hh" + +#include + +namespace { + + CATCH_TEST_CASE("value-type - decibel") { + clap::DecibelValueType vt; + + CATCH_CHECK(vt.toParam(vt.toEngine(3)) == 3); + } + +} // namespace \ No newline at end of file