23 lines
606 B
C++
23 lines
606 B
C++
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include <catch2/catch_all.hpp>
|
|
#include "../common/CorrelationCoefficient.h"
|
|
|
|
TEST_CASE("CorrelationCoefficient") {
|
|
CorrelationCoefficient cc;
|
|
CHECK(std::isnan(cc.GetCC()));
|
|
|
|
cc.Add(100.0, 500.0);
|
|
CHECK(std::isnan(cc.GetCC()));
|
|
|
|
cc.Add(200.0, 1000.0);
|
|
CHECK(cc.GetCC() == Catch::Approx(1.0));
|
|
|
|
cc.Add(300.0, 1500.0);
|
|
CHECK(cc.GetCC() == Catch::Approx(1.0));
|
|
|
|
cc.Add(400.0, 2000.0);
|
|
CHECK(cc.GetCC() == Catch::Approx(1.0));
|
|
}
|