Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-21 07:51:51

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 "ActsExamples/Io/Root/detail/RootFileHasherHelpers.hpp"
0012 
0013 #include <string>
0014 
0015 using ActsExamples::detail::firstTemplateArg;
0016 
0017 BOOST_AUTO_TEST_SUITE(RootFileHasherHelpers)
0018 
0019 BOOST_AUTO_TEST_CASE(FirstTemplateArgSimple) {
0020   BOOST_CHECK_EQUAL(firstTemplateArg("vector<float>"), "float");
0021   BOOST_CHECK_EQUAL(firstTemplateArg("vector<unsigned int>"), "unsigned int");
0022 }
0023 
0024 BOOST_AUTO_TEST_CASE(FirstTemplateArgNested) {
0025   // Legacy ROOT spelling with a space before the closing angle bracket.
0026   BOOST_CHECK_EQUAL(firstTemplateArg("vector<vector<int> >"), "vector<int>");
0027   // Modern spelling without the space.
0028   BOOST_CHECK_EQUAL(firstTemplateArg("vector<vector<int>>"), "vector<int>");
0029 }
0030 
0031 BOOST_AUTO_TEST_CASE(FirstTemplateArgStopsAtTopLevelComma) {
0032   // Only the first top-level argument is returned; a nested comma is ignored.
0033   BOOST_CHECK_EQUAL(firstTemplateArg("map<int,float>"), "int");
0034   BOOST_CHECK_EQUAL(firstTemplateArg("map<vector<int,short>,float>"),
0035                     "vector<int,short>");
0036 }
0037 
0038 BOOST_AUTO_TEST_CASE(FirstTemplateArgTrimsWhitespace) {
0039   BOOST_CHECK_EQUAL(firstTemplateArg("vector< float >"), "float");
0040 }
0041 
0042 BOOST_AUTO_TEST_CASE(FirstTemplateArgNoTemplate) {
0043   BOOST_CHECK_EQUAL(firstTemplateArg("Float_t"), "");
0044   BOOST_CHECK_EQUAL(firstTemplateArg(""), "");
0045 }
0046 
0047 BOOST_AUTO_TEST_SUITE_END()