Improvements before MAX IV test
This commit is contained in:
19
tests/RegressionTest.cpp
Normal file
19
tests/RegressionTest.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright (2019-2024) Paul Scherrer Institute
|
||||
|
||||
// Copyright (2019-2024) Paul Scherrer Institute
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include "../image_analysis/Regression.h"
|
||||
|
||||
TEST_CASE("Regression") {
|
||||
std::vector<float> x(10);
|
||||
std::vector<float> y(10);
|
||||
for (int i = 0; i < x.size(); i++) {
|
||||
x[i] = i;
|
||||
y[i] = 7 * i + 5;
|
||||
}
|
||||
auto reg = regression(x, y);
|
||||
REQUIRE(reg.intercept == Approx(5.0));
|
||||
REQUIRE(reg.slope == Approx(7.0));
|
||||
}
|
||||
Reference in New Issue
Block a user