Added tests

This commit is contained in:
Paul Ferrand 2019-11-23 19:10:37 +01:00
parent d485cace00
commit 8e6955e43a
5 changed files with 62 additions and 15 deletions

View file

@ -44,4 +44,8 @@ endif()
if (SFIZZ_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
if (SFIZZ_TESTS)
add_subdirectory(tests)
endif()

View file

@ -63,16 +63,18 @@ add_library(sfizz::sfizz ALIAS sfizz)
# Shared library and installation target
add_library(sfizz_shared SHARED sfizz/sfizz_wrapper.cpp)
set_target_properties(sfizz_shared PROPERTIES OUTPUT_NAME sfizz PUBLIC_HEADER sfizz.h)
target_link_libraries(sfizz_shared sfizz::sfizz)
configure_file(${CMAKE_SOURCE_DIR}/scripts/sfizz.pc.in sfizz.pc @ONLY)
if(UNIX)
include(GNUInstallDirs)
install(TARGETS sfizz_shared
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/static
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES
${CMAKE_BINARY_DIR}/src/sfizz.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
endif()
if (SFIZZ_SHARED)
add_library(sfizz_shared SHARED sfizz/sfizz_wrapper.cpp)
set_target_properties(sfizz_shared PROPERTIES OUTPUT_NAME sfizz PUBLIC_HEADER sfizz.h)
target_link_libraries(sfizz_shared sfizz::sfizz)
configure_file(${CMAKE_SOURCE_DIR}/scripts/sfizz.pc.in sfizz.pc @ONLY)
if(UNIX)
include(GNUInstallDirs)
install(TARGETS sfizz_shared
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/static
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES
${CMAKE_BINARY_DIR}/src/sfizz.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
endif()
endif(SFIZZ_SHARED)

41
tests/CMakeLists.txt Normal file
View file

@ -0,0 +1,41 @@
###############################
# Test application
project(sfizz)
set(SFIZZ_TEST_SOURCES
RegionT.cpp
RegexT.cpp
HelpersT.cpp
HelpersT.cpp
AudioBufferT.cpp
RangeT.cpp
OpcodeT.cpp
BufferT.cpp
SIMDHelpersT.cpp
FilesT.cpp
OnePoleFilterT.cpp
RegionActivationT.cpp
RegionCrossfadesT.cpp
ADSREnvelopeT.cpp
LinearEnvelopeT.cpp
MainT.cpp
RegionTriggersT.cpp
)
find_package(ZLIB REQUIRED)
add_library(cnpy cnpy/cnpy.cpp)
target_link_libraries(cnpy PRIVATE ZLIB::ZLIB)
target_include_directories(cnpy PUBLIC cnpy)
add_executable(sfizz_tests ${SFIZZ_TEST_SOURCES})
target_link_libraries(sfizz_tests PRIVATE sfizz::sfizz)
# Per OS properties
if(UNIX)
target_link_libraries(sfizz_tests PRIVATE atomic)
endif(UNIX)
target_link_libraries(sfizz_tests PRIVATE absl::strings absl::str_format absl::flat_hash_map sndfile cnpy absl::span absl::algorithm)
target_include_directories(sfizz_tests SYSTEM PRIVATE sources)
file(COPY "." DESTINATION ${CMAKE_BINARY_DIR}/tests)

View file

@ -23,7 +23,7 @@
#include "Synth.h"
#include "catch2/catch.hpp"
#include "../sfizz/ghc/fs_std.hpp"
#include "ghc/fs_std.hpp"
using namespace Catch::literals;
TEST_CASE("[Files] Single region (regions_one.sfz)")

View file

@ -24,7 +24,7 @@
#include "OnePoleFilter.h"
#include "catch2/catch.hpp"
#include "cnpy.h"
#include "../sfizz/ghc/fs_std.hpp"
#include "ghc/fs_std.hpp"
#include <absl/types/span.h>
#include <algorithm>
#include <string>