20 lines
484 B
C++
20 lines
484 B
C++
// Copyright (2019-2024) Paul Scherrer Institute
|
|
|
|
// Copyright (2019-2024) Paul Scherrer Institute
|
|
|
|
#include <catch2/catch_all.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 == Catch::Approx(5.0));
|
|
REQUIRE(reg.slope == Catch::Approx(7.0));
|
|
}
|