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

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (return values from fcl)
 

Functions

 BOOST_AUTO_TEST_CASE (atom)
 
 BOOST_AUTO_TEST_CASE (seq_vector)
 
 BOOST_AUTO_TEST_CASE (seq_array)
 
 BOOST_AUTO_TEST_CASE (tuple)
 
 BOOST_AUTO_TEST_CASE (tuple_with_vector)
 
 BOOST_AUTO_TEST_CASE (tuple_with_array)
 
 BOOST_AUTO_TEST_CASE (tuple_with_tuple)
 
 BOOST_AUTO_TEST_CASE (vec_of_tups)
 
 BOOST_AUTO_TEST_CASE (arr_of_tups)
 
 BOOST_AUTO_TEST_CASE (vec_of_vecs)
 
 BOOST_AUTO_TEST_CASE (vec_of_arrs)
 
 BOOST_AUTO_TEST_CASE (arr_of_vecs)
 
 BOOST_AUTO_TEST_CASE (arr_of_arrs)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (return values from fcl)

Definition at line 10 of file return_values_from_fcl_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( atom  )

Definition at line 58 of file return_values_from_fcl_t.cc.

59 {
60  BOOST_TEST(config().atom() == 5);
61 }
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( seq_vector  )

Definition at line 64 of file return_values_from_fcl_t.cc.

65 {
66  auto ref = {3, 5, 8};
67  auto val = config().vec();
68  BOOST_TEST(val == ref, boost::test_tools::per_element{});
69 }
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( seq_array  )

Definition at line 72 of file return_values_from_fcl_t.cc.

73 {
74  auto ref = {4, 9};
75  auto val = config().arr();
76  BOOST_TEST(val == ref, boost::test_tools::per_element{});
77 }
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( tuple  )

Definition at line 80 of file return_values_from_fcl_t.cc.

81 {
82  BOOST_TEST(config().tuple.get<0>() == 5);
83  BOOST_TEST(config().tuple.get<1>() == 4.3, tolerance);
84  BOOST_TEST(config().tuple.get<2>() == true);
85 }
auto const tolerance
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( tuple_with_vector  )

Definition at line 88 of file return_values_from_fcl_t.cc.

89 {
90  auto ref = {4, 1, 4, 67, 89};
91  auto val = config().tupWithVec.get<0>();
92  BOOST_TEST(val == ref, boost::test_tools::per_element{});
93  BOOST_TEST(config().tupWithVec.get<1>() == 4.56789, tolerance);
94  BOOST_TEST(config().tupWithVec.get<2>() == false);
95 }
auto const tolerance
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( tuple_with_array  )

Definition at line 98 of file return_values_from_fcl_t.cc.

99 {
100  auto ref = {5, 16};
101  auto val = config().tupWithArr.get<0>();
102  BOOST_TEST(val == ref, boost::test_tools::per_element{});
103  BOOST_TEST(config().tupWithArr.get<1>() == 46.9, tolerance);
104  BOOST_TEST(config().tupWithArr.get<2>() == true);
105 }
auto const tolerance
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( tuple_with_tuple  )

Definition at line 108 of file return_values_from_fcl_t.cc.

109 {
110  auto tuple0 = config().tupWithTup.get<0>();
111  BOOST_TEST(std::get<0>(tuple0) == 4);
112  BOOST_TEST(std::get<1>(tuple0) == 175.218f, ftolerance);
113  BOOST_TEST(config().tupWithTup.get<1>() == 87.03, tolerance);
114  BOOST_TEST(config().tupWithTup.get<2>() == false);
115 }
auto const tolerance
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( vec_of_tups  )

Definition at line 118 of file return_values_from_fcl_t.cc.

119 {
120  vector<int> const nums{11, 22};
121  vector<string> const strs{"Decay in orbit", "Radiative pion capture"};
122 
123  size_t i{};
124  for (auto const& elem : config().vecWithTup()) {
125  BOOST_TEST(std::get<0>(elem) == nums.at(i));
126  BOOST_TEST(std::get<1>(elem) == strs.at(i++));
127  }
128 }
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( arr_of_tups  )

Definition at line 131 of file return_values_from_fcl_t.cc.

132 {
133 
134  vector<string> const prefixes = {"Tchaikovsky wrote ", "Mahler wrote "};
135  vector<int> const nums{6, 9};
136  string const str = " symphonies";
137 
138  size_t i{};
139  for (auto const& elem : config().arrWithTup()) {
140  BOOST_TEST(std::get<0>(elem) == prefixes.at(i));
141  BOOST_TEST(std::get<1>(elem) == nums.at(i++));
142  BOOST_TEST(std::get<2>(elem) == str);
143  }
144 }
static Config * config
Definition: config.cpp:1054
static QCString str
BOOST_AUTO_TEST_CASE ( vec_of_vecs  )

Definition at line 147 of file return_values_from_fcl_t.cc.

148 {
149  using vec_t = vector<int>;
150  auto ref_vec = {vec_t{1, 4, 6, 8}, vec_t{1, 3}, vec_t{6}};
151  auto it = ref_vec.begin();
152 
153  for (auto const& val : config().vecOfVec()) {
154  auto ref = *it++;
155  BOOST_TEST(val == ref, boost::test_tools::per_element{});
156  }
157 
158  size_t i{};
159  for (auto const& ref : ref_vec) {
160  auto val = config().vecOfVec(i++);
161  BOOST_TEST(val == ref, boost::test_tools::per_element{});
162  }
163 }
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( vec_of_arrs  )

Definition at line 166 of file return_values_from_fcl_t.cc.

167 {
168  using array_t = array<int, 2>;
169  auto ref_vec = {array_t{{1, 6}}, array_t{{2, 12}}, array_t{{3, 18}}};
170  auto it = ref_vec.begin();
171 
172  for (auto const& val : config().vecOfArr()) {
173  auto ref = *it++;
174  BOOST_TEST(val == ref, boost::test_tools::per_element{});
175  }
176 }
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( arr_of_vecs  )

Definition at line 179 of file return_values_from_fcl_t.cc.

180 {
181  auto ref_vec = {vector<int>{1, 2, 3, 4, 5, 6, 7}, vector<int>{8, 9, 10}};
182  auto it = ref_vec.begin();
183 
184  for (auto const& val : config().arrOfVec()) {
185  auto ref = *it++;
186  BOOST_TEST(val == ref, boost::test_tools::per_element{});
187  }
188 }
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( arr_of_arrs  )

Definition at line 191 of file return_values_from_fcl_t.cc.

192 {
193  auto ref_vec = {array<int, 2>{{1, 0}}, array<int, 2>{{0, 1}}};
194  auto it = ref_vec.begin();
195 
196  for (auto const& val : config().arrOfArr()) {
197  auto ref = *it++;
198  BOOST_TEST(val == ref, boost::test_tools::per_element{});
199  }
200 }
static Config * config
Definition: config.cpp:1054