mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-07-09 20:23:03 +02:00
Build on RHEL9 docker image / build (push) Successful in 4m1s
Build on RHEL8 docker image / build (push) Successful in 5m1s
Build and Deploy on local RHEL9 / build (push) Successful in 2m1s
Build and Deploy on local RHEL8 / build (push) Successful in 5m7s
Run Simulator Tests on local RHEL9 / build (push) Successful in 18m37s
Run Simulator Tests on local RHEL8 / build (push) Successful in 22m10s
* refactoring * wip * refactored, yet to take out checkers * checker added * wip acquire ctb state * wip acquire ctb state * wip, acq test * acquire moved out * fix * wip, To fix masterattribtues * wip, masterfilecheks * wip, at ctbexpectedstate * wip, fixing acquire * wip, acquire done * wip * compiles * refactoring * minor * minor * reduced unnecessary includes * fix in tests * removed ctb state check * ctb fix with ctb state * fixed ctb guard tests * minor debug * work for xilinx ctb --------- Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
#pragma once
|
|
|
|
#include "Readers.h"
|
|
#include "ReadersJson.h"
|
|
#ifdef HDF5C
|
|
#include "ReadersH5.h"
|
|
#endif
|
|
|
|
#include "catch.hpp"
|
|
|
|
namespace sls::test::master_file {
|
|
|
|
template <typename Context> class Checker;
|
|
|
|
/** JSON Specialization */
|
|
template <> class Checker<JsonContext> {
|
|
public:
|
|
explicit Checker(const std::string &path) : ctx_(path) {}
|
|
explicit Checker(JsonContext ctx) : ctx_(std::move(ctx)) {}
|
|
const JsonContext &context() const { return ctx_; }
|
|
|
|
template <typename T>
|
|
void check(const std::string &name, const T &expected,
|
|
AccessType = AccessType::Dataset) const {
|
|
CAPTURE(name);
|
|
REQUIRE(ctx_.doc.HasMember(name.c_str()));
|
|
auto retval = read<JsonContext, T>(ctx_, name);
|
|
REQUIRE(retval == expected);
|
|
}
|
|
|
|
private:
|
|
JsonContext ctx_;
|
|
};
|
|
|
|
/** HDF5 Specialization */
|
|
#ifdef HDF5C
|
|
|
|
template <> class Checker<H5Context> {
|
|
public:
|
|
explicit Checker(const std::string &path) : ctx_(path) {}
|
|
explicit Checker(H5Context ctx) : ctx_(std::move(ctx)) {}
|
|
const H5Context &context() const { return ctx_; }
|
|
|
|
template <typename T>
|
|
void check(const std::string &name, const T &expected,
|
|
AccessType access = AccessType::Dataset) const {
|
|
auto retval = read<H5Context, T>(ctx_, name, access);
|
|
REQUIRE(retval == expected);
|
|
}
|
|
|
|
private:
|
|
H5Context ctx_;
|
|
};
|
|
|
|
#endif
|
|
|
|
} // namespace sls::test::master_file
|