Improvements before MAX IV test

This commit is contained in:
2024-04-25 20:11:58 +02:00
parent 2c8e1fd83d
commit ea70b27e85
80 changed files with 1835 additions and 1781 deletions

19
tests/RegressionTest.cpp Normal file
View 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));
}