initial commit

This commit is contained in:
Uwe Jakobeit
2026-03-30 09:41:19 +02:00
parent 7928ce3239
commit 00f8e9a751
76 changed files with 8341 additions and 1 deletions

7
tests/CMakeLists.txt Normal file
View File

@@ -0,0 +1,7 @@
find_package(GTest REQUIRED)
add_executable(tests filter-test.cpp)
target_link_libraries(tests GTest::gtest_main app_lib)
include(GoogleTest)
gtest_discover_tests(tests)

26
tests/filter-test.cpp Normal file
View File

@@ -0,0 +1,26 @@
#ifndef FILTER_TEST_CPP
#define FILTER_TEST_CPP
#include <gtest/gtest.h>
#include "filter.h"
TEST(PT1FilterTest, InitialOutputIsZero) {
PT1Filter filter(0.1, 0.01);
EXPECT_DOUBLE_EQ(filter.update(0.0), 0.0);
}
TEST(PT1FilterTest, StepResponse) {
PT1Filter filter(0.1, 0.01);
double output = 0.0;
for (int i = 0; i < 100; ++i) {
output = filter.update(1.0);
}
EXPECT_NEAR(output, 1.0, 0.01);
}
TEST(PT1FilterTest, FilterFactorEffect) {
PT1Filter fastFilter(0.01, 0.01);
PT1Filter slowFilter(0.5, 0.01);
EXPECT_GT(fastFilter.update(1.0), slowFilter.update(1.0));
}
#endif // FILTER_TEST_CPP