Macros | Functions
keymap_defaults_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "KeyMap.h"
#include "fhiclcpp/types/Atom.h"
#include "fhiclcpp/types/Sequence.h"
#include "fhiclcpp/types/Tuple.h"
#include <string>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (keymap test)
 

Functions

 BOOST_AUTO_TEST_CASE (one_atom_t)
 
 BOOST_AUTO_TEST_CASE (one_sequence_t)
 
 BOOST_AUTO_TEST_CASE (one_sequence_2_t)
 
 BOOST_AUTO_TEST_CASE (one_tuple_t)
 
 BOOST_AUTO_TEST_CASE (seq_in_tuple_t)
 
 BOOST_AUTO_TEST_CASE (bounded_seq_in_tuple_t)
 
 BOOST_AUTO_TEST_CASE (tuple_in_tuple_t)
 
 BOOST_AUTO_TEST_CASE (tuple_in_seq_t)
 
 BOOST_AUTO_TEST_CASE (tuple_in_seq_2_t)
 
 BOOST_AUTO_TEST_CASE (seq_in_seq_t)
 
 BOOST_AUTO_TEST_CASE (seq_2_in_seq_t)
 
 BOOST_AUTO_TEST_CASE (seq_in_seq_2_t)
 
 BOOST_AUTO_TEST_CASE (seq_2_in_seq_2_t)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (keymap test)

Definition at line 11 of file keymap_defaults_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( one_atom_t  )

Definition at line 29 of file keymap_defaults_t.cc.

30 {
31  KeyMap km;
32  Atom<int> test{Name("atom"), 4};
33  km.walk_over(test);
34 
35  auto map = km.result();
36  auto ref = {"atom"};
37  BOOST_TEST(map == ref, boost::test_tools::per_element{});
38 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( one_sequence_t  )

Definition at line 41 of file keymap_defaults_t.cc.

42 {
43  KeyMap km;
44  Sequence<int> test{Name("sequence"), {1, 2, 4}};
45  km.walk_over(test);
46 
47  auto map = km.result();
48  auto ref = {"sequence", "sequence[0]", "sequence[1]", "sequence[2]"};
49  BOOST_TEST(map == ref, boost::test_tools::per_element{});
50 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( one_sequence_2_t  )

Definition at line 53 of file keymap_defaults_t.cc.

54 {
55  KeyMap km;
56  Sequence<int, 2> test{Name("sequence"), {5, 7}};
57  km.walk_over(test);
58 
59  auto map = km.result();
60  auto ref = {"sequence", "sequence[0]", "sequence[1]"};
61  BOOST_TEST(map == ref, boost::test_tools::per_element{});
62 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( one_tuple_t  )

Definition at line 65 of file keymap_defaults_t.cc.

66 {
67  KeyMap km;
68  Tuple<int, double, bool> test{Name("tuple"), {4, 1.5, false}};
69  km.walk_over(test);
70 
71  auto map = km.result();
72  auto ref = {"tuple", "tuple[0]", "tuple[1]", "tuple[2]"};
73  BOOST_TEST(map == ref, boost::test_tools::per_element{});
74 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( seq_in_tuple_t  )

Definition at line 77 of file keymap_defaults_t.cc.

78 {
79  KeyMap km;
80  Tuple<Sequence<int>, double, bool> test{Name("tuple"),
81  {{1, 3, 5}, 4.6, true}};
82  km.walk_over(test);
83 
84  auto map = km.result(); // key_map(&test);
85  auto ref = {"tuple",
86  "tuple[0]",
87  "tuple[0][0]",
88  "tuple[0][1]",
89  "tuple[0][2]",
90  "tuple[1]",
91  "tuple[2]"};
92  BOOST_TEST(map == ref, boost::test_tools::per_element{});
93 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( bounded_seq_in_tuple_t  )

Definition at line 96 of file keymap_defaults_t.cc.

97 {
98  KeyMap km;
99  Tuple<Sequence<int, 2>, double, bool> test{Name("tuple"),
100  {{9, 15}, 0.2, false}};
101  km.walk_over(test);
102 
103  auto map = km.result();
104  auto ref = {
105  "tuple", "tuple[0]", "tuple[0][0]", "tuple[0][1]", "tuple[1]", "tuple[2]"};
106  BOOST_TEST(map == ref, boost::test_tools::per_element{});
107 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( tuple_in_tuple_t  )

Definition at line 110 of file keymap_defaults_t.cc.

111 {
112  KeyMap km;
113  Tuple<Tuple<int, float>, double, bool> test{Name("tuple"),
114  {{4, 3.7f}, 8.1, true}};
115  km.walk_over(test);
116 
117  auto map = km.result();
118  auto ref = {
119  "tuple", "tuple[0]", "tuple[0][0]", "tuple[0][1]", "tuple[1]", "tuple[2]"};
120  BOOST_TEST(map == ref, boost::test_tools::per_element{});
121 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( tuple_in_seq_t  )

Definition at line 124 of file keymap_defaults_t.cc.

125 {
126  KeyMap km;
127  Sequence<Tuple<int, float>> test{Name("seqtuple"),
128  {{2, 5.4f}, {4, 104.5f}, {8, 15.3f}}};
129  km.walk_over(test);
130 
131  auto map = km.result();
132  auto ref = {"seqtuple",
133  "seqtuple[0]",
134  "seqtuple[0][0]",
135  "seqtuple[0][1]",
136  "seqtuple[1]",
137  "seqtuple[1][0]",
138  "seqtuple[1][1]",
139  "seqtuple[2]",
140  "seqtuple[2][0]",
141  "seqtuple[2][1]"};
142  BOOST_TEST(map == ref, boost::test_tools::per_element{});
143 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( tuple_in_seq_2_t  )

Definition at line 146 of file keymap_defaults_t.cc.

147 {
148  KeyMap km;
149  Sequence<Tuple<int, float>, 2> test{Name("seqtuple"), {{1, 2.3f}, {9, 3.2f}}};
150  km.walk_over(test);
151 
152  auto map = km.result();
153  auto ref = {"seqtuple",
154  "seqtuple[0]",
155  "seqtuple[0][0]",
156  "seqtuple[0][1]",
157  "seqtuple[1]",
158  "seqtuple[1][0]",
159  "seqtuple[1][1]"};
160  BOOST_TEST(map == ref, boost::test_tools::per_element{});
161 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( seq_in_seq_t  )

Definition at line 164 of file keymap_defaults_t.cc.

165 {
166  KeyMap km;
167  Sequence<Sequence<int>> test{Name("seqseq"), {{1, 5, 7}, {2}}};
168  km.walk_over(test);
169 
170  auto map = km.result();
171  auto ref = {"seqseq",
172  "seqseq[0]",
173  "seqseq[0][0]",
174  "seqseq[0][1]",
175  "seqseq[0][2]",
176  "seqseq[1]",
177  "seqseq[1][0]"};
178  BOOST_TEST(map == ref, boost::test_tools::per_element{});
179 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( seq_2_in_seq_t  )

Definition at line 182 of file keymap_defaults_t.cc.

183 {
184  KeyMap km;
185  Sequence<Sequence<int, 2>> test{Name("seqseq"), {{1, 2}}};
186  km.walk_over(test);
187 
188  auto map = km.result();
189  auto ref = {"seqseq", "seqseq[0]", "seqseq[0][0]", "seqseq[0][1]"};
190  BOOST_TEST(map == ref, boost::test_tools::per_element{});
191 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( seq_in_seq_2_t  )

Definition at line 194 of file keymap_defaults_t.cc.

195 {
196  KeyMap km;
197  Sequence<Sequence<int>, 2> test{Name("seqseq"), {{4}, {1, 4, 9, 1}}};
198  km.walk_over(test);
199 
200  auto map = km.result();
201  auto ref = {"seqseq",
202  "seqseq[0]",
203  "seqseq[0][0]",
204  "seqseq[1]",
205  "seqseq[1][0]",
206  "seqseq[1][1]",
207  "seqseq[1][2]",
208  "seqseq[1][3]"};
209  BOOST_TEST(map == ref, boost::test_tools::per_element{});
210 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16
BOOST_AUTO_TEST_CASE ( seq_2_in_seq_2_t  )

Definition at line 213 of file keymap_defaults_t.cc.

214 {
215  KeyMap km;
216  Sequence<Sequence<int, 2>, 2> test{Name("seqseq"), {{6, 7}, {2, 1}}};
217  km.walk_over(test);
218 
219  auto map = km.result();
220  auto ref = {"seqseq",
221  "seqseq[0]",
222  "seqseq[0][0]",
223  "seqseq[0][1]",
224  "seqseq[1]",
225  "seqseq[1][0]",
226  "seqseq[1][1]"};
227  BOOST_TEST(map == ref, boost::test_tools::per_element{});
228 }
ChannelGroupService::Name Name
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
auto const & result() const
Definition: KeyMap.h:16