From f918c1cc804beb2e6d7f248ba1165c58a89bebc6 Mon Sep 17 00:00:00 2001 From: Anjal Doshi Date: Thu, 7 Nov 2024 17:53:24 -0800 Subject: [PATCH] Fix incorrectly failing tests --- .../BandpassFilter/Tests/BandpassFilterTests.cpp | 13 +++++-------- Plugins/CommonAvgRef/Tests/CommonAvgRefTests.cpp | 4 ++-- Tests/Processors/ChannelInfoObjectTests.cpp | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Plugins/BandpassFilter/Tests/BandpassFilterTests.cpp b/Plugins/BandpassFilter/Tests/BandpassFilterTests.cpp index 31da292a7..69c163e11 100644 --- a/Plugins/BandpassFilter/Tests/BandpassFilterTests.cpp +++ b/Plugins/BandpassFilter/Tests/BandpassFilterTests.cpp @@ -71,8 +71,6 @@ class BandpassFilterTests : public ::testing::Test { Parameter* param = processor->getDataStream (streamId)->getParameter ("low_cut"); param->setNextValue (value); - processor->parameterValueChanged (param); - processor->updateSettings(); if (assert_set) { ASSERT_EQ (getLowCut(), value); @@ -83,8 +81,6 @@ class BandpassFilterTests : public ::testing::Test { Parameter* param = processor->getDataStream (streamId)->getParameter ("high_cut"); param->setNextValue (value); - processor->parameterValueChanged (param); - processor->updateSettings(); if (assert_set) { ASSERT_EQ (getHighCut(), value); @@ -133,7 +129,7 @@ TEST_F (BandpassFilterTests, TestRespectsLowHighCutSetting) setLowCut (10.0, false); ASSERT_FLOAT_EQ (getLowCut(), 10.0f); - setHighCut (10000.0, false); + setHighCut (6000.0, false); ASSERT_FLOAT_EQ (getLowCut(), 10.0f); ASSERT_FLOAT_EQ (getHighCut(), 6000.0f); @@ -143,9 +139,10 @@ TEST_F (BandpassFilterTests, TestRespectsLowHighCutSetting) ASSERT_FLOAT_EQ (getHighCut(), 6000.0f); // Same with an invalid low cut; it's ignored - setLowCut (20000.0f, false); - ASSERT_FLOAT_EQ (getLowCut(), 600.0f); - ASSERT_FLOAT_EQ (getHighCut(), 6000.0f); + setHighCut (900.0f, false); + setLowCut (950.0f, false); + ASSERT_FLOAT_EQ (getLowCut(), 10.0f); + ASSERT_FLOAT_EQ (getHighCut(), 900.0f); } TEST_F (BandpassFilterTests, Test_SignalInPassband) diff --git a/Plugins/CommonAvgRef/Tests/CommonAvgRefTests.cpp b/Plugins/CommonAvgRef/Tests/CommonAvgRefTests.cpp index 633f2280d..2bec5d6af 100644 --- a/Plugins/CommonAvgRef/Tests/CommonAvgRefTests.cpp +++ b/Plugins/CommonAvgRef/Tests/CommonAvgRefTests.cpp @@ -120,10 +120,10 @@ TEST_F (CommonAverageRefTests, CommonAverageTest) // Set 1st channel as reference and second as affected in every stream for (auto stream : processor->getDataStreams()) { - auto referenceChans = (SelectedChannelsParameter*) stream->getParameter ("Reference"); + auto referenceChans = (MaskChannelsParameter*) stream->getParameter ("reference"); referenceChans->currentValue = Array ({ 0 }); - auto affectedChans = (SelectedChannelsParameter*) stream->getParameter ("Affected"); + auto affectedChans = (MaskChannelsParameter*) stream->getParameter ("affected"); affectedChans->currentValue = Array ({ 1 }); } diff --git a/Tests/Processors/ChannelInfoObjectTests.cpp b/Tests/Processors/ChannelInfoObjectTests.cpp index ee4d1c7b8..763542eb1 100644 --- a/Tests/Processors/ChannelInfoObjectTests.cpp +++ b/Tests/Processors/ChannelInfoObjectTests.cpp @@ -39,7 +39,7 @@ TEST (ChannelInfoObjectTests, GetStreamId) DataStream::Settings settings; DataStream stream (settings); ChannelInfoObject channel (InfoObject::Type::CONTINUOUS_CHANNEL, &stream); - uint16_t expectedStreamId = 10060; + uint16_t expectedStreamId = stream.getStreamId(); // Act uint16_t actualStreamId = channel.getStreamId();