14 #define BOOST_TEST_MODULE ( zip_test ) 15 #include <boost/test/unit_test.hpp> 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(
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());
88 unsigned int iLoop = 0U;
89 for (
auto&& i [[gnu::unused]]:
util::zip()) {}
91 BOOST_TEST(iLoop == 0);
Definition of util::zip().
BOOST_AUTO_TEST_CASE(zip_testcase)
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.