2018-10-25 09:43:21 +00:00
|
|
|
#define BOOST_TEST_MODULE GenericFilterTests
|
|
|
|
|
|
|
|
#include "fratio.h"
|
2018-12-14 11:30:44 +00:00
|
|
|
#include "typedefs.h"
|
2018-10-25 09:43:21 +00:00
|
|
|
#include <boost/test/unit_test.hpp>
|
2018-12-14 11:30:44 +00:00
|
|
|
#include <vector>
|
2018-10-25 09:43:21 +00:00
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(FilterThrows)
|
|
|
|
{
|
2018-12-14 11:30:44 +00:00
|
|
|
auto dfd = fratio::DigitalFilterd(Eigen::VectorXd(), Eigen::VectorXd::Constant(2, 0));
|
|
|
|
BOOST_REQUIRE(dfd.status() == fratio::FilterStatus::A_COEFF_MISSING);
|
|
|
|
dfd = fratio::DigitalFilterd(Eigen::VectorXd::Constant(2, 1), Eigen::VectorXd());
|
|
|
|
BOOST_REQUIRE(dfd.status() == fratio::FilterStatus::B_COEFF_MISSING);
|
|
|
|
dfd = fratio::DigitalFilterd(Eigen::VectorXd(), Eigen::VectorXd());
|
|
|
|
BOOST_REQUIRE(dfd.status() == fratio::FilterStatus::ALL_COEFF_MISSING);
|
|
|
|
dfd = fratio::DigitalFilterd(Eigen::VectorXd::Constant(2, 0), Eigen::VectorXd::Constant(2, 0));
|
|
|
|
BOOST_REQUIRE(dfd.status() == fratio::FilterStatus::BAD_A_COEFF);
|
|
|
|
dfd = fratio::DigitalFilterd();
|
|
|
|
BOOST_REQUIRE(dfd.status() == fratio::FilterStatus::NONE);
|
|
|
|
dfd = fratio::DigitalFilterd(Eigen::VectorXd::Constant(2, 1), Eigen::VectorXd::Constant(2, 0));
|
|
|
|
BOOST_REQUIRE(dfd.status() == fratio::FilterStatus::READY);
|
2018-10-25 09:43:21 +00:00
|
|
|
}
|