Macros | Functions
InputTag_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "canvas/Utilities/InputTag.h"
#include <set>
#include <string>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (InputTag_t)
 

Functions

 BOOST_AUTO_TEST_CASE (InputTag_default_ctor)
 
 BOOST_AUTO_TEST_CASE (InputTag_from_string)
 
 BOOST_AUTO_TEST_CASE (InputTag_from_two_strings)
 
 BOOST_AUTO_TEST_CASE (InputTag_from_three_strings)
 
 BOOST_AUTO_TEST_CASE (InputTag_from_one_cstring)
 
std::string grabLabel (art::InputTag const &t)
 
 BOOST_AUTO_TEST_CASE (InputTag_convert_from_string)
 
 BOOST_AUTO_TEST_CASE (InputTag_convert_from_cstring)
 
 BOOST_AUTO_TEST_CASE (InputTagEmptyFields_1)
 
 BOOST_AUTO_TEST_CASE (InputTagEmptyFields_2)
 
 BOOST_AUTO_TEST_CASE (InputTagEmptyFields_3)
 
 BOOST_AUTO_TEST_CASE (InputTagEmptyFields_4)
 
 BOOST_AUTO_TEST_CASE (InputTag_comparison)
 
 BOOST_AUTO_TEST_CASE (InputTag_set)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (InputTag_t)

Definition at line 1 of file InputTag_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( InputTag_default_ctor  )

Definition at line 10 of file InputTag_t.cc.

11 {
14  BOOST_TEST(t.label() == empty);
15  BOOST_TEST(t.instance() == empty);
16  BOOST_TEST(t.process() == empty);
17 }
std::string string
Definition: nybbler.cc:12
std::string const & instance() const noexcept
Definition: InputTag.cc:85
std::string const & process() const noexcept
Definition: InputTag.cc:91
std::string const & label() const noexcept
Definition: InputTag.cc:79
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
BOOST_AUTO_TEST_CASE ( InputTag_from_string  )

Definition at line 19 of file InputTag_t.cc.

20 {
22  std::string mylabel("thisIsMyLabel");
23  art::InputTag t(mylabel);
24  BOOST_TEST(t.label() == mylabel);
25  BOOST_TEST(t.instance() == empty);
26  BOOST_TEST(t.process() == empty);
27 }
std::string string
Definition: nybbler.cc:12
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
BOOST_AUTO_TEST_CASE ( InputTag_from_two_strings  )

Definition at line 29 of file InputTag_t.cc.

30 {
32  std::string mylabel("thisIsMylabel");
33  std::string myinstance("someinstance");
34  art::InputTag t(mylabel, myinstance);
35  BOOST_TEST(t.label() == mylabel);
36  BOOST_TEST(t.instance() == myinstance);
37  BOOST_TEST(t.process() == empty);
38 }
std::string string
Definition: nybbler.cc:12
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
BOOST_AUTO_TEST_CASE ( InputTag_from_three_strings  )

Definition at line 40 of file InputTag_t.cc.

41 {
42  std::string mylabel("thisIsMylabel");
43  std::string myinstance("someinstance");
44  std::string myprocess("aprocess");
45  art::InputTag t(mylabel, myinstance, myprocess);
46  BOOST_TEST(t.label() == mylabel);
47  BOOST_TEST(t.instance() == myinstance);
48  BOOST_TEST(t.process() == myprocess);
49 }
std::string string
Definition: nybbler.cc:12
BOOST_AUTO_TEST_CASE ( InputTag_from_one_cstring  )

Definition at line 51 of file InputTag_t.cc.

52 {
53  const char* mylabel = "mylabel";
55  art::InputTag t(mylabel);
56  BOOST_TEST(t.label() == std::string(mylabel));
57  BOOST_TEST(t.instance() == empty);
58  BOOST_TEST(t.process() == empty);
59 }
std::string string
Definition: nybbler.cc:12
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
BOOST_AUTO_TEST_CASE ( InputTag_convert_from_string  )

Definition at line 67 of file InputTag_t.cc.

68 {
69  std::string mylabel("alabel");
70  std::string result = grabLabel(mylabel);
71  BOOST_TEST(mylabel == result);
72 }
static QCString result
std::string string
Definition: nybbler.cc:12
std::string grabLabel(art::InputTag const &t)
Definition: InputTag_t.cc:62
BOOST_AUTO_TEST_CASE ( InputTag_convert_from_cstring  )

Definition at line 74 of file InputTag_t.cc.

75 {
76  const char* mylabel = "alabel";
77  std::string result = grabLabel(mylabel);
78  BOOST_TEST(std::string(mylabel) == result);
79 }
static QCString result
std::string string
Definition: nybbler.cc:12
std::string grabLabel(art::InputTag const &t)
Definition: InputTag_t.cc:62
BOOST_AUTO_TEST_CASE ( InputTagEmptyFields_1  )

Definition at line 81 of file InputTag_t.cc.

82 {
83  art::InputTag a1("alabel::aprocess");
84  BOOST_TEST(a1.label() == std::string("alabel"));
85  BOOST_TEST(a1.instance() == std::string());
86  BOOST_TEST(a1.process() == std::string("aprocess"));
87 }
std::string string
Definition: nybbler.cc:12
#define a1
BOOST_AUTO_TEST_CASE ( InputTagEmptyFields_2  )

Definition at line 89 of file InputTag_t.cc.

90 {
91  art::InputTag a1(":aninstance:aprocess");
92  BOOST_TEST(a1.label() == std::string());
93  BOOST_TEST(a1.instance() == std::string("aninstance"));
94  BOOST_TEST(a1.process() == std::string("aprocess"));
95 }
std::string string
Definition: nybbler.cc:12
#define a1
BOOST_AUTO_TEST_CASE ( InputTagEmptyFields_3  )

Definition at line 97 of file InputTag_t.cc.

98 {
99  art::InputTag a1("alabel:aninstance:");
100  BOOST_TEST(a1.label() == std::string("alabel"));
101  BOOST_TEST(a1.instance() == std::string("aninstance"));
102  BOOST_TEST(a1.process() == std::string());
103 }
std::string string
Definition: nybbler.cc:12
#define a1
BOOST_AUTO_TEST_CASE ( InputTagEmptyFields_4  )

Definition at line 105 of file InputTag_t.cc.

106 {
107  art::InputTag a1("alabel:aninstance");
108  BOOST_TEST(a1.label() == std::string("alabel"));
109  BOOST_TEST(a1.instance() == std::string("aninstance"));
110  BOOST_TEST(a1.process() == std::string());
111 }
std::string string
Definition: nybbler.cc:12
#define a1
BOOST_AUTO_TEST_CASE ( InputTag_comparison  )

Definition at line 113 of file InputTag_t.cc.

114 {
115  art::InputTag const a1{"alabel:aname:aprocess"};
116  art::InputTag const a2{"alabel:aname:aprocess"};
117  auto const a3{a1};
118  art::InputTag const b1{"alabel:aname:anotherprocess"};
119  art::InputTag const b2{"alabel:anothername:aprocess"};
120  art::InputTag const b3{"anotherlabel:aname:aprocess"};
121  BOOST_TEST(a1 == a2);
122  BOOST_TEST(a1 == a3);
123  BOOST_TEST(a2 == a3);
124  BOOST_TEST(a3 == a1);
125  BOOST_TEST(a1 != b1);
126  BOOST_TEST(a1 != b2);
127  BOOST_TEST(a1 != b3);
128  BOOST_TEST(b1 != b2);
129  BOOST_TEST(b1 != b3);
130  BOOST_TEST(b2 != b3);
131 }
#define a2
#define a3
#define a1
BOOST_AUTO_TEST_CASE ( InputTag_set  )

Definition at line 133 of file InputTag_t.cc.

134 {
135  std::set<art::InputTag> test;
136  test.emplace("c", "i");
137  test.emplace("a::");
138  test.emplace("b");
139 
140  std::vector<art::InputTag> const ref{"a::", "b", "c:i:"};
141  BOOST_TEST(test == ref, boost::test_tools::per_element{});
142 
143  // Test that an already present InputTag is not inserted again.
144  BOOST_TEST(test.emplace("c:i").second == false);
145 }
std::string grabLabel ( art::InputTag const &  t)

Definition at line 62 of file InputTag_t.cc.

63 {
64  return t.label();
65 }