Added a test for the base delay
This commit is contained in:
parent
bb612e1f4d
commit
4bce1dc0d9
2 changed files with 20 additions and 4 deletions
|
|
@ -16,7 +16,7 @@ set(SFIZZ_TEST_SOURCES
|
|||
FilesT.cpp
|
||||
OnePoleFilterT.cpp
|
||||
RegionActivationT.cpp
|
||||
RegionCrossfadesT.cpp
|
||||
RegionValueComputationsT.cpp
|
||||
ADSREnvelopeT.cpp
|
||||
LinearEnvelopeT.cpp
|
||||
MainT.cpp
|
||||
|
|
@ -39,4 +39,4 @@ target_link_libraries(sfizz_tests PRIVATE absl::strings absl::str_format absl::f
|
|||
target_include_directories(sfizz_tests SYSTEM PRIVATE sources)
|
||||
sfizz_enable_lto_if_needed(sfizz_tests)
|
||||
|
||||
file(COPY "." DESTINATION ${CMAKE_BINARY_DIR}/tests)
|
||||
file(COPY "." DESTINATION ${CMAKE_BINARY_DIR}/tests)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include <thread>
|
||||
#include "MidiState.h"
|
||||
using namespace Catch::literals;
|
||||
|
||||
constexpr int numRandomTests { 64 };
|
||||
TEST_CASE("[Region] Crossfade in on key")
|
||||
{
|
||||
sfz::MidiState midiState;
|
||||
|
|
@ -293,4 +293,20 @@ TEST_CASE("[Region] rt_decay")
|
|||
midiState.noteOn(64, 64);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
REQUIRE( region.getBaseVolumedB(64) == Approx(sfz::Default::volume).margin(0.1) );
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("[Region] Base delay")
|
||||
{
|
||||
sfz::MidiState midiState;
|
||||
sfz::Region region{ midiState };
|
||||
region.parseOpcode({ "sample", "*sine" });
|
||||
region.parseOpcode({ "delay", "10" });
|
||||
REQUIRE( region.getDelay() == 10.0f );
|
||||
region.parseOpcode({ "delay_random", "10" });
|
||||
Random::randomGenerator.seed(42);
|
||||
for (int i = 0; i < numRandomTests; ++i)
|
||||
{
|
||||
auto delay = region.getDelay();
|
||||
REQUIRE( (delay >= 10.0 && delay <= 20.0) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue