mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-11-25 03:07:55 +01:00
Add first template for InclusiveROI unit tests
This commit is contained in:
1 parent
d7addfba3e
commit
fc871377a0
2 files changed
+21
No files matched your search
@@ -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