Utility: update filter unit tests with decoupling test.
Some checks reported errors
continuous-integration/drone/push Build encountered an error
gitea/skullc-peripherals/pipeline/head This commit looks good

This commit is contained in:
Erki 2022-12-12 00:12:07 +02:00
parent 47d7e87023
commit 927b950dec
2 changed files with 14 additions and 1 deletions

View File

@ -123,6 +123,19 @@ TEST_CASE("Two filters can be linked together.")
REQUIRE(high_pass.currentValue() == 46);
}
}
SECTION("Decoupling filters works as expected.")
{
high_pass.update(60);
REQUIRE(high_pass.currentValue() == 0);
high_pass.clearPrecedingFilter();
high_pass.update(60);
REQUIRE(high_pass.currentValue() == 60);
high_pass.update(30);
REQUIRE(high_pass.currentValue() == 60);
}
}
TEST_CASE("Median filter works as expected.")

View File

@ -12,7 +12,7 @@ template<typename T>
class IFilter
{
public:
virtual ~IFilter() {}
virtual ~IFilter() = default;
void assignPrecedingFilter(IFilter<T>& filter)
{