Test of util::enumerate and support utilities.
More...
#include "larcorealg/CoreUtils/enumerate.h"
#include <boost/test/unit_test.hpp>
#include <vector>
#include <array>
#include <cstddef>
#include <cassert>
Go to the source code of this file.
Test of util::enumerate and support utilities.
- Author
- Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.slac..nosp@m.stan.nosp@m.ford..nosp@m.edu)
- Date
- April 14, 2019
Definition in file enumerate_test.cc.
| #define BOOST_TEST_MODULE ( enumerate_test ) |
| BOOST_AUTO_TEST_CASE |
( |
enumerate_testcase |
| ) |
|
Definition at line 25 of file enumerate_test.cc.
32 constexpr std::size_t
N = 7U;
34 std::array<int, N> twice;
35 std::vector<double> thrice(N + 1);
37 for (std::size_t i = 0; i <
N; ++i) {
46 unsigned int iLoop = 0;
49 BOOST_TEST(i == iLoop);
51 BOOST_TEST(
a == twice[iLoop]);
52 BOOST_TEST(&
a == &(twice[iLoop]));
54 BOOST_TEST(b == thrice[iLoop]);
55 BOOST_TEST(&b == &thrice[iLoop]);
59 BOOST_TEST(iLoop == twice.size());
68 assert(thrice.size() == N - 1);
71 for (
auto&& [i,
a, b]: util::enumerate<1>(twice, thrice)) {
73 BOOST_TEST(i == iLoop);
75 BOOST_TEST(
a == twice[iLoop]);
76 BOOST_TEST(&
a == &(twice[iLoop]));
78 BOOST_TEST(b == thrice[iLoop]);
79 BOOST_TEST(&b == &thrice[iLoop]);
83 BOOST_TEST(iLoop == thrice.size());
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
process_name largeant stream1 can override from command line with o or output physics producers generator N