Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:14

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 // Detray test include(s)
0012 #include "detray/test/framework/whiteboard.hpp"
0013 
0014 // GTest include(s)
0015 #include <gtest/gtest.h>
0016 
0017 // System include(s)
0018 #include <memory>
0019 #include <source_location>
0020 
0021 namespace detray::test {
0022 
0023 template <template <typename> class check_t, typename detector_t,
0024           typename config_t = typename check_t<detector_t>::config>
0025 void register_checks(const detector_t &det,
0026                      const typename detector_t::name_map &vol_names,
0027                      const config_t &cfg,
0028                      const typename detector_t::geometry_context &gctx) {
0029   const char *test_name = cfg.name().c_str();
0030   if (!test_name) {
0031     throw std::invalid_argument("Invalid test name");
0032   }
0033 
0034   const std::source_location src_loc{};
0035 
0036   ::testing::RegisterTest("detray_validation", test_name, nullptr, test_name,
0037                           src_loc.file_name(), src_loc.line(),
0038                           [&det, &vol_names, &cfg, &gctx]() ->
0039                           typename check_t<detector_t>::fixture_type * {
0040                             return new check_t<detector_t>(det, vol_names, cfg,
0041                                                            gctx);
0042                           });
0043 }
0044 
0045 template <template <typename> class check_t, typename detector_t,
0046           typename config_t = typename check_t<detector_t>::config>
0047 void register_checks(const detector_t &det,
0048                      const typename detector_t::name_map &vol_names,
0049                      const config_t &cfg,
0050                      const typename detector_t::geometry_context &gctx,
0051                      std::shared_ptr<test::whiteboard> &wb) {
0052   const char *test_name = cfg.name().c_str();
0053   if (!test_name) {
0054     throw std::invalid_argument("Invalid test name");
0055   }
0056 
0057   const std::source_location src_loc{};
0058 
0059   ::testing::RegisterTest("detray_validation", test_name, nullptr, test_name,
0060                           src_loc.file_name(), src_loc.line(),
0061                           [&det, &vol_names, &cfg, &gctx, &wb]() ->
0062                           typename check_t<detector_t>::fixture_type * {
0063                             return new check_t<detector_t>(det, vol_names, cfg,
0064                                                            wb, gctx);
0065                           });
0066 }
0067 
0068 }  // namespace detray::test