33 lines
807 B
C++
33 lines
807 B
C++
#include <catch2/catch_test_macros.hpp>
|
|
|
|
#include "filter_fir_crude.h"
|
|
#include "ICalibrator.h"
|
|
|
|
TEST_CASE("Filter Modules", "[filter]")
|
|
{
|
|
SECTION("FIR Filter Crude Implementation")
|
|
{
|
|
float coeffs[] = {1,1,1};
|
|
FilterFIRCrude filter1(coeffs, 3);
|
|
|
|
filter1.process(10);
|
|
filter1.process(10);
|
|
auto res = filter1.process(10);
|
|
|
|
REQUIRE(res == 10);
|
|
}
|
|
|
|
SECTION("Linear Calibration")
|
|
{
|
|
std::pair<double, double> p1 (1, 1);
|
|
std::pair<double, double> p2 (10, 10);
|
|
|
|
auto pc = std::make_pair(p1, p2);
|
|
floatpump::Calibrator<floatpump::LinearCalibrator> calibrator (pc);
|
|
|
|
REQUIRE(calibrator.translate(1) == 1);
|
|
REQUIRE(calibrator.translate(5) == 5);
|
|
REQUIRE(calibrator.translate(10) == 10);
|
|
|
|
}
|
|
} |