Audacity 3.2.0
DynamicRangeProcessorHistoryTests.cpp
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 DynamicRangeProcessorHistoryTests.cpp
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
13#include <catch2/catch.hpp>
14
15TEST_CASE("DynamicRangeProcessorHistory")
16{
18 constexpr auto numFramesInHistory = 10;
19 constexpr int framesPerSecond = numFramesInHistory / SUT::maxTimeSeconds;
20 SUT sut { framesPerSecond };
21 const auto& segments = sut.GetSegments();
22 REQUIRE(segments.empty());
23
24 constexpr auto sampsPerPacket = 1;
25
26 // Pushing two samples
27 sut.Push({ { 1, sampsPerPacket }, { 2, sampsPerPacket } });
28 REQUIRE(!segments.empty());
29
30 const auto& history = segments.front();
31 REQUIRE(history.size() == 2);
32
33 // Pushing one new sample, and two old samples are also pushed
34 // redundantly.
35 sut.Push(
36 { { 1, sampsPerPacket }, { 2, sampsPerPacket }, { 3, sampsPerPacket } });
37 REQUIRE(history.size() == 3);
38
39 // Pushing two fresh samples
40 sut.Push({ { 4, sampsPerPacket }, { 5, sampsPerPacket } });
41 REQUIRE(history.size() == 5);
42}
TEST_CASE("DynamicRangeProcessorHistory")
const std::vector< Segment > & GetSegments() const