Add first template for InclusiveROI unit tests

This commit is contained in:
2026-08-24 18:31:21 +02:00
parent d7addfba3e
commit fc871377a0
2 changed files with 21 additions and 0 deletions
+5
View File
@@ -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);
+16
View File
@@ -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});
}
}