From 8cd13383834c9af6fd8ba190a41ad682398bc8d7 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Thu, 12 Sep 2024 10:22:11 +0100 Subject: [PATCH] Add test for test_calculate_decay_coefficient --- tests/test_util.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test_util.py b/tests/test_util.py index 86836423..f6ecd1f5 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -45,4 +45,14 @@ def test_save_block_to_text_file(): @pytest.mark.skip def test_save_block_to_wav_file(): - pass \ No newline at end of file + pass + + +def test_calculate_decay_coefficient(): + decay_time = 0.5 + sample_rate = 48000 + decay_level = 0.001 + + exponent = signalflow.calculate_decay_coefficient(decay_time, sample_rate, decay_level) + rv = exponent ** (decay_time * sample_rate) + assert rv == pytest.approx(decay_level, abs=1e-6) \ No newline at end of file