mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-09-03 06:10:42 +02:00
Add first template for InclusiveROI unit tests
This commit is contained in:
@@ -34,6 +34,11 @@ struct InclusiveROI {
|
||||
return xmin >= 0 && ymin >= 0 && xmax < ncols && ymax < nrows;
|
||||
}
|
||||
|
||||
constexpr bool operator==(InclusiveROI const &other) const noexcept {
|
||||
return xmin == other.xmin && xmax == other.xmax && ymin == other.ymin &&
|
||||
ymax == other.ymax;
|
||||
}
|
||||
|
||||
static InclusiveROI emptyROI() noexcept { return {0, -1, 0, -1}; }
|
||||
// TODO (nice to have)
|
||||
// static InclusiveROI from_shape(ssize_t width, ssize_t height);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "aare/InclusiveROI.hpp"
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
using namespace aare;
|
||||
|
||||
TEST_CASE("mirror_on_y mirrors ROI about vertical axis",
|
||||
"[InlusiveROIgeometry]") {
|
||||
|
||||
SECTION("ROI on left side of axis") {
|
||||
InclusiveROI roi{1, 3, 10, 20};
|
||||
|
||||
auto mirrored = inclusiveroi::geom::mirror_on_y(roi, 5);
|
||||
|
||||
REQUIRE(mirrored == InclusiveROI{6, 8, 10, 20});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user