36 lines
1.1 KiB
C++
36 lines
1.1 KiB
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/GoniometerAxis.h"
|
|
|
|
TEST_CASE("GoniometerAxis_GetWedge") {
|
|
GoniometerAxis axis("omega", 0.0, 1.0, Coord(0,0,1), {});
|
|
REQUIRE(axis.GetWedge_deg() == Catch::Approx(1.0f));
|
|
axis.ScreeningWedge(0.1);
|
|
REQUIRE(axis.GetWedge_deg() == Catch::Approx(0.1f));
|
|
}
|
|
|
|
TEST_CASE("GoniometerAxis_GetAngleContainer") {
|
|
GoniometerAxis axis("omega", 0.0, 1.0, Coord(0,0,1), {});
|
|
|
|
auto v = axis.GetAngleContainer(1000);
|
|
|
|
REQUIRE(v.size() == 1000);
|
|
CHECK(v[0] == Catch::Approx(0.0f));
|
|
CHECK(v[50] == Catch::Approx(50.0f));
|
|
CHECK(v[999] == Catch::Approx(999.0f));
|
|
}
|
|
|
|
TEST_CASE("GoniometerAxis_GetAngleContainerEnd") {
|
|
GoniometerAxis axis("omega", 0.0, 1.0, Coord(0,0,1), {});
|
|
axis.ScreeningWedge(0.5);
|
|
|
|
auto v = axis.GetAngleContainerEnd(1000);
|
|
|
|
REQUIRE(v.size() == 1000);
|
|
CHECK(v[0] == Catch::Approx(0.5f));
|
|
CHECK(v[50] == Catch::Approx(50.5f));
|
|
CHECK(v[999] == Catch::Approx(999.5f));
|
|
} |