From 75c27b05778bdc0e7afe1401235ed958a2fa968d Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Wed, 1 Apr 2020 00:18:03 +0200 Subject: [PATCH] Disable the "updated" tests in favor of integration tests --- tests/ADSREnvelopeT.cpp | 46 ++++++++++++++++------------------------- tests/CMakeLists.txt | 2 ++ 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/tests/ADSREnvelopeT.cpp b/tests/ADSREnvelopeT.cpp index 7def3ec9..df104407 100644 --- a/tests/ADSREnvelopeT.cpp +++ b/tests/ADSREnvelopeT.cpp @@ -33,8 +33,7 @@ TEST_CASE("[ADSREnvelope] Basic state") sfz::ADSREnvelope envelope; std::array output; std::array expected { 0.0, 0.0, 0.0, 0.0, 0.0 }; - for (auto& out : output) - out = envelope.getNextValue(); + envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); absl::c_fill(output, -1.0f); @@ -51,9 +50,8 @@ TEST_CASE("[ADSREnvelope] Attack") envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); std::array output; - std::array expected { 0.0f, 0.5f, 1.0f, 1.0f, 1.0f }; - for (auto& out : output) - out = envelope.getNextValue(); + std::array expected { 0.5f, 1.0f, 1.0f, 1.0f, 1.0f }; + envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); @@ -71,9 +69,8 @@ TEST_CASE("[ADSREnvelope] Attack again") envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); std::array output; - std::array expected { 0.0f, 0.33333f, 0.66667f, 1.0f, 1.0f }; - for (auto& out : output) - out = envelope.getNextValue(); + std::array expected { 0.33333f, 0.66667f, 1.0f, 1.0f, 1.0f }; + envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); @@ -92,10 +89,9 @@ TEST_CASE("[ADSREnvelope] Release") envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); envelope.startRelease(2); - std::array output; - std::array expected { 0.0f, 0.5f, 1.0f, 0.08409f, 0.00707f, 0.000594604f, 0.00005f, 0.0f, 0.0f }; - for (auto& out : output) - out = envelope.getNextValue(); + std::array output; + std::array expected { 0.5f, 1.0f, 0.13534f, 0.018f, 0.0024f, 0.0f, 0.0f, 0.0f }; + envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); @@ -116,9 +112,8 @@ TEST_CASE("[ADSREnvelope] Delay") std::array output; envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); envelope.startRelease(4); - std::array expected { 0.0f, 0.0f, 0.0f, 0.5f, 1.0f, 0.08409f, 0.00707f, 0.000594604f, 0.00005f, 0.0f, 0.0f }; - for (auto& out : output) - out = envelope.getNextValue(); + std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 0.13534f, 0.018f, 0.0024f, 0.0f, 0.0f, 0.0f }; + envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); @@ -139,9 +134,8 @@ TEST_CASE("[ADSREnvelope] Lower sustain") region.amplitudeEG.sustain = 50.0f; std::array output; envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); - std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f }; - for (auto& out : output) - out = envelope.getNextValue(); + std::array expected { 0.0f, 0.0f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f }; + envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); @@ -162,9 +156,8 @@ TEST_CASE("[ADSREnvelope] Decay") region.amplitudeEG.decay = 0.02f; std::array output; envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); - std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 0.707107f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5 }; - for (auto& out : output) - out = envelope.getNextValue(); + std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5 }; + envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); @@ -187,8 +180,7 @@ TEST_CASE("[ADSREnvelope] Hold") std::array output; envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 1.0f, 1.0f, 0.707107f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f }; - for (auto& out : output) - out = envelope.getNextValue(); + envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); @@ -212,8 +204,7 @@ TEST_CASE("[ADSREnvelope] Hold with release") envelope.startRelease(8); std::array output; std::array expected { 0.0f, 0.0f, 0.0f, 0.5f, 1.0f, 1.0f, 1.0f, 0.707107f, 0.5f, 0.05f, 0.005f, 0.0005f, 0.00005f, 0.0f, 0.0f }; - for (auto& out : output) - out = envelope.getNextValue(); + envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); @@ -237,9 +228,8 @@ TEST_CASE("[ADSREnvelope] Hold with release 2") envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); envelope.startRelease(4); std::array output; - std::array expected { 0.0f, 0.0f, 0.0f, 0.5f, 1.0f, 0.08409f, 0.00707f, 0.000594604f, 0.00005f, 0.0f, 0.0f, 0.0f, 0.0 }; - for (auto& out : output) - out = envelope.getNextValue(); + std::array expected { 0.0f, 0.0f, 0.5f, 1.0f, 0.08409f, 0.00707f, 0.000594604f, 0.00005f, 0.0f, 0.0f, 0.0f, 0.0 }; + envelope.getBlock(absl::MakeSpan(output)); REQUIRE(approxEqual(output, expected)); envelope.reset(region.amplitudeEG, region, state, 0, 0.0f, 100.0f); envelope.startRelease(4); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 408deb52..423c867e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,6 +19,8 @@ set(SFIZZ_TEST_SOURCES OnePoleFilterT.cpp RegionActivationT.cpp RegionValueComputationsT.cpp + # If we're tweaking the curves this kind of tests does not make sense + # Use integration tests with comparison curves # ADSREnvelopeT.cpp EventEnvelopesT.cpp MainT.cpp