Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:05

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/unit_test.hpp>
0010 
0011 #include "ActsFatras/Kernel/InteractionList.hpp"
0012 
0013 #include <tuple>
0014 
0015 namespace ActsFatras::detail {
0016 template <class T, class Tuple>
0017 struct TupleIndexOf;
0018 }  // namespace ActsFatras::detail
0019 
0020 using ActsFatras::detail::TupleIndexOf;
0021 
0022 BOOST_AUTO_TEST_SUITE(FatrasTupleIndexOf)
0023 
0024 BOOST_AUTO_TEST_CASE(Regular) {
0025   using T = std::tuple<int, double, float>;
0026 
0027   BOOST_CHECK_EQUAL((TupleIndexOf<int, T>::value), 0u);
0028   BOOST_CHECK_EQUAL((TupleIndexOf<double, T>::value), 1u);
0029   BOOST_CHECK_EQUAL((TupleIndexOf<float, T>::value), 2u);
0030 }
0031 
0032 BOOST_AUTO_TEST_CASE(Duplicates) {
0033   using T = std::tuple<double, int, double>;
0034 
0035   // should return the first matching type
0036   BOOST_CHECK_EQUAL((TupleIndexOf<double, T>::value), 0u);
0037   BOOST_CHECK_EQUAL((TupleIndexOf<int, T>::value), 1u);
0038 }
0039 
0040 BOOST_AUTO_TEST_SUITE_END()