Test of util::zip()
.
More...
#include "larcorealg/CoreUtils/zip.h"
#include <boost/test/unit_test.hpp>
#include <vector>
#include <array>
#include <cstddef>
#include <cassert>
Go to the source code of this file.
#define BOOST_TEST_MODULE ( zip_test ) |
BOOST_AUTO_TEST_CASE |
( |
zip_testcase |
| ) |
|
Definition at line 86 of file zip_test.cc.
88 unsigned int iLoop = 0U;
89 for (
auto&& i [[gnu::unused]]:
util::zip()) {}
91 BOOST_TEST(iLoop == 0);
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition at line 25 of file zip_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;
47 for (
auto&& [
a, b ]:
util::zip(twice, thrice)) {
49 BOOST_TEST(
a == twice[iLoop]);
50 BOOST_TEST(&
a == &(twice[iLoop]));
52 BOOST_TEST(b == thrice[iLoop]);
53 BOOST_TEST(&b == &thrice[iLoop]);
57 BOOST_TEST(iLoop == twice.size());
66 assert(thrice.size() == N - 1);
69 for (
auto&& [
a, b ]: util::zip<1>(twice, thrice)) {
71 BOOST_TEST(
a == twice[iLoop]);
72 BOOST_TEST(&
a == &(twice[iLoop]));
74 BOOST_TEST(b == thrice[iLoop]);
75 BOOST_TEST(&b == &thrice[iLoop]);
79 BOOST_TEST(iLoop == thrice.size());
process_name largeant stream1 can override from command line with o or output physics producers generator N
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.