Unit tests
Catch2
Include Catch2
option(YOURPLUGIN_BUILD_TESTS "Build the unit tests with Catch2" ON)
if(YOURPLUGIN_BUILD_TESTS)
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/3rd_party/Catch2/contrib")
enable_testing()
add_subdirectory(3rd_party/Catch2 EXCLUDE_FROM_ALL)
include(CTest)
include(Catch)
endif()Write Test
main
We need to write a custom main for Catch, since we need to initialize & shutdown JUCE.
processor
Simple tests checking the plug-in name & if a mono bus layout is supported.
Link against SharedCode
Link the unit test target to the shared code of your plug-in.
CTest
After building run ctest inside your build directory.
JUCE Unit Tests
How to run them in a plug-in build
Last updated
Was this helpful?