only test over the public interface

This commit is contained in:
2025-06-23 12:16:41 +02:00
parent c6990dabad
commit 318e640639
3 changed files with 15 additions and 23 deletions

View File

@ -14,11 +14,6 @@
namespace aare {
#ifdef AARE_TESTS
TEST_CASE_PRIVATE_FWD(check_find_geometry) // forward declaration
TEST_CASE_PRIVATE_FWD(open_multi_module_file_with_roi)
#endif
/**
* @brief Class to read .raw files. The class will parse the master file
* to find the correct geometry for the frames.
@ -27,10 +22,6 @@ TEST_CASE_PRIVATE_FWD(open_multi_module_file_with_roi)
*/
class RawFile : public FileInterface {
#ifdef AARE_TESTS
FRIEND_TEST(check_find_geometry)
FRIEND_TEST(open_multi_module_file_with_roi)
#endif
std::vector<std::unique_ptr<RawSubFile>> m_subfiles;
RawMasterFile m_master;
@ -69,9 +60,9 @@ class RawFile : public FileInterface {
size_t rows() const override;
size_t cols() const override;
size_t bitdepth() const override;
xy geometry();
size_t n_modules() const;
size_t n_modules_in_roi() const;
xy geometry() const;
RawMasterFile master() const;

View File

@ -95,7 +95,10 @@ size_t RawFile::total_frames() const { return m_master.frames_in_file(); }
size_t RawFile::rows() const { return m_geometry.pixels_y(); }
size_t RawFile::cols() const { return m_geometry.pixels_x(); }
size_t RawFile::bitdepth() const { return m_master.bitdepth(); }
xy RawFile::geometry() { return m_master.geometry(); }
xy RawFile::geometry() const {
return xy{static_cast<uint32_t>(m_geometry.modules_y()),
static_cast<uint32_t>(m_geometry.modules_x())};
}
size_t RawFile::n_modules() const { return m_geometry.n_modules(); };
size_t RawFile::n_modules_in_roi() const {

View File

@ -174,8 +174,7 @@ struct TestParameters {
std::vector<ModuleGeometry> module_geometries{};
};
TEST_CASE_PRIVATE(aare, check_find_geometry, "check find_geometry",
"[.integration][.files][.rawfile]") {
TEST_CASE("check find_geometry", "[.integration][.files][.rawfile]") {
auto test_parameters = GENERATE(
TestParameters{"raw/jungfrau_2modules_version6.1.2/run_master_0.raw", 2,
@ -211,9 +210,11 @@ TEST_CASE_PRIVATE(aare, check_find_geometry, "check find_geometry",
REQUIRE(std::filesystem::exists(fpath));
RawFile f(fpath, "r");
RawMasterFile master_file(fpath);
auto geometry = f.m_geometry;
auto geometry = DetectorGeometry(
master_file.geometry(), master_file.pixels_x(), master_file.pixels_y(),
master_file.udp_interfaces_per_module(), master_file.quad());
CHECK(geometry.modules_x() == test_parameters.modules_x);
CHECK(geometry.modules_y() == test_parameters.modules_y);
@ -224,6 +225,7 @@ TEST_CASE_PRIVATE(aare, check_find_geometry, "check find_geometry",
test_parameters.num_ports);
// compare to data stored in header
RawFile f(fpath, "r");
for (size_t i = 0; i < test_parameters.num_ports; ++i) {
auto subfile1_path = f.master().data_fname(i, 0);
@ -246,11 +248,8 @@ TEST_CASE_PRIVATE(aare, check_find_geometry, "check find_geometry",
}
}
} // close the namespace
TEST_CASE_PRIVATE(aare, open_multi_module_file_with_roi,
"Open multi module file with ROI",
"[.integration][.files][.rawfile]") {
TEST_CASE("Open multi module file with ROI",
"[.integration][.files][.rawfile]") {
auto fpath = test_data_path() / "raw/SingleChipROI/Data_master_0.json";
REQUIRE(std::filesystem::exists(fpath));
@ -261,9 +260,9 @@ TEST_CASE_PRIVATE(aare, open_multi_module_file_with_roi,
REQUIRE(f.master().roi().value().width() == 256);
REQUIRE(f.master().roi().value().height() == 256);
CHECK(f.m_geometry.n_modules() == 2);
CHECK(f.n_modules() == 2);
CHECK(f.m_geometry.n_modules_in_roi() == 1);
CHECK(f.n_modules_in_roi() == 1);
auto frames = f.read_n(2);
@ -273,7 +272,6 @@ TEST_CASE_PRIVATE(aare, open_multi_module_file_with_roi,
CHECK(frames[1].cols() == 256);
}
}
} // close namespace aare
TEST_CASE("Read file with unordered frames", "[.integration]") {
// TODO! Better explanation and error message