FriendlyName_t.cc
Go to the documentation of this file.
1 #define BOOST_TEST_MODULE (FriendlyName_t)
2 #include "boost/test/unit_test.hpp"
3 
5 
6 #include <map>
7 #include <string>
8 
9 namespace {
10  typedef std::map<std::string, std::string> fnmap_t;
11 }
12 
15 
16  fnmap_t nameMap;
17 };
18 
20 {
21  nameMap.insert(std::make_pair("Foo", "Foo"));
22  nameMap.insert(std::make_pair("bar::Foo", "bar::Foo"));
23  nameMap.insert(std::make_pair("std::vector<Foo>", "Foos"));
24  nameMap.insert(std::make_pair("std::vector<bar::Foo>", "bar::Foos"));
25  nameMap.insert(std::make_pair("V<A,B>", "ABV"));
26  nameMap.insert(
27  std::make_pair("art::Wrapper<MuonDigiCollection<CSCDetId,CSCALCTDigi> >",
28  "CSCDetIdCSCALCTDigiMuonDigiCollection"));
29  nameMap.insert(std::make_pair("A<B<C>,D<E> >", "CBEDA"));
30  nameMap.insert(std::make_pair("A<B<C<D> > >", "DCBA"));
31  nameMap.insert(std::make_pair("A<B<C,D>,E<F> >", "CDBFEA"));
32  nameMap.insert(std::make_pair("Aa<Bb<Cc>,Dd<Ee> >", "CcBbEeDdAa"));
33  nameMap.insert(std::make_pair("Aa<Bb<Cc<Dd> > >", "DdCcBbAa"));
34  nameMap.insert(std::make_pair("Aa<Bb<Cc,Dd>,Ee<Ff> >", "CcDdBbFfEeAa"));
35  nameMap.insert(std::make_pair("Aa<Bb<Cc,Dd>,Ee<Ff,Gg> >", "CcDdBbFfGgEeAa"));
36  nameMap.insert(std::make_pair("cet::map_vector_key", "mvk"));
37  nameMap.insert(std::make_pair("cet::map_vector<Foo>", "Foomv"));
38  nameMap.insert(std::make_pair("art::Assns<Ll,Rr,Dd>", "LlRrDdart::Assns"));
39  nameMap.insert(std::make_pair("art::Assns<Rr,Ll,Dd>", "LlRrDdart::Assns"));
40 }
41 
42 BOOST_FIXTURE_TEST_SUITE(FriendlyName_t, FriendlyNameTestFixture)
43 
44 BOOST_AUTO_TEST_CASE(FriendlyName_t)
45 {
46  for (auto const& pr : nameMap) {
47  BOOST_TEST(art::friendlyname::friendlyName(pr.first) == pr.second);
48  }
49 }
50 
51 BOOST_AUTO_TEST_SUITE_END()
std::string friendlyName(std::string const &iFullName)
BOOST_AUTO_TEST_CASE(FriendlyName_t)