Audacity 3.2.0
Functions
DynamicRangeProcessorHistoryTests.cpp File Reference
#include "DynamicRangeProcessorHistory.h"
#include "DynamicRangeProcessorTypes.h"
#include <catch2/catch.hpp>
Include dependency graph for DynamicRangeProcessorHistoryTests.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("DynamicRangeProcessorHistory")
 

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "DynamicRangeProcessorHistory"  )

Audacity: A Digital Audio Editor

DynamicRangeProcessorHistoryTests.cpp

Matthieu Hodgkinson

Definition at line 15 of file DynamicRangeProcessorHistoryTests.cpp.

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}
const std::vector< Segment > & GetSegments() const

References DynamicRangeProcessorHistory::GetSegments().

Here is the call graph for this function: