Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-14 08:02:34

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 // the purpose of these tests is to ensure that the version header is valid and
0010 // the exported parameters are accessible. otherwise, there would is no code
0011 // that actually includes the version header.
0012 
0013 #include <boost/test/unit_test.hpp>
0014 
0015 #include "Acts/ActsVersion.hpp"
0016 
0017 #include <string_view>
0018 
0019 BOOST_AUTO_TEST_CASE(Version) {
0020   // the only way to get a zero version would be zero for all components
0021   BOOST_CHECK_LT(0u, Acts::Version);
0022   // these tests are not really useful as the version components can be any
0023   // value. they are there so we touch all variables and ensure that they are
0024   // accessible.
0025   BOOST_CHECK_LE(0u, Acts::VersionMajor);
0026   BOOST_CHECK_LE(0u, Acts::VersionMinor);
0027   BOOST_CHECK_LE(0u, Acts::VersionPatch);
0028 }
0029 
0030 BOOST_AUTO_TEST_CASE(CommitHash) {
0031   // CommitHash can be empty by default at build time
0032   // This test just checks that the variables are accessible
0033   auto hash = Acts::CommitHash;
0034   auto hashShort = Acts::CommitHashShort;
0035   (void)hash;       // suppress unused warning
0036   (void)hashShort;  // suppress unused warning
0037 }
0038 
0039 BOOST_AUTO_TEST_CASE(VersionInfo) {
0040   // Test VersionInfo creation from header
0041   auto headerInfo = Acts::VersionInfo::fromHeader();
0042   BOOST_CHECK_EQUAL(headerInfo.versionMajor, Acts::VersionMajor);
0043   BOOST_CHECK_EQUAL(headerInfo.versionMinor, Acts::VersionMinor);
0044   BOOST_CHECK_EQUAL(headerInfo.versionPatch, Acts::VersionPatch);
0045 
0046   // Test VersionInfo creation from library (should have no hash)
0047   auto libraryInfo = Acts::VersionInfo::fromLibrary();
0048   BOOST_CHECK_EQUAL(libraryInfo.versionMajor, Acts::VersionMajor);
0049   BOOST_CHECK_EQUAL(libraryInfo.versionMinor, Acts::VersionMinor);
0050   BOOST_CHECK_EQUAL(libraryInfo.versionPatch, Acts::VersionPatch);
0051   BOOST_CHECK(!libraryInfo.commitHash.has_value());
0052 
0053   // Test equality comparison
0054   BOOST_CHECK(libraryInfo == libraryInfo);
0055 }