Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-20 08:42:21

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 #include <boost/test/tools/old/interface.hpp>
0010 #include <boost/test/unit_test.hpp>
0011 
0012 #include "Acts/Utilities/Logger.hpp"
0013 #include "ActsPlugins/Mille/MillePedeError.hpp"
0014 #include "ActsPlugins/Mille/MillePedeSteering.hpp"
0015 
0016 #include <filesystem>
0017 
0018 using namespace ActsPlugins;
0019 
0020 BOOST_AUTO_TEST_SUITE(MillePedeSteeringTests)
0021 
0022 /// catch a missing steering file
0023 BOOST_AUTO_TEST_CASE(invalidSteeringDest) {
0024   auto logger =
0025       Acts::getDefaultLogger("invalidSteeringDest", Acts::Logging::INFO);
0026   // This test deliberately emits an error
0027   // message. To prevent the ACTS CI from
0028   // interpreting this as a failure,
0029   // we temporarily disable the failure threshold
0030   Acts::Logging::ScopedFailureThreshold threshold{Acts::Logging::Level::MAX};
0031   MillePedeSteeringConfig steerCfg;
0032   auto res = ActsPlugins::generateMillePedeSteeringFile(
0033       "/invalid/location/wontWork.txt", steerCfg, *logger);
0034   BOOST_CHECK(!res.ok());
0035   BOOST_CHECK_EQUAL(res.error(), MillePedeError::UnableToWriteSteering);
0036 }
0037 
0038 /// write a valid file
0039 BOOST_AUTO_TEST_CASE(validFileCheck) {
0040   auto logger = Acts::getDefaultLogger("validFileCheck", Acts::Logging::INFO);
0041   MillePedeSteeringConfig steerCfg{.inputFiles = {"DummyBinary.dat"}};
0042   const std::filesystem::path testSteer = "testSteer.txt";
0043   auto res =
0044       ActsPlugins::generateMillePedeSteeringFile(testSteer, steerCfg, *logger);
0045   BOOST_CHECK(res.ok());
0046   BOOST_CHECK(res.value() == testSteer);
0047   BOOST_CHECK(std::filesystem::exists(testSteer) &&
0048               std::filesystem::is_regular_file(testSteer));
0049 }
0050 
0051 BOOST_AUTO_TEST_SUITE_END()