From 81f652c80c086ea008a4cd325f4e73764a9aa10a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 18 Aug 2018 21:49:38 +0200 Subject: Add mask interface and isolate rack details from algorithm --- test/test_bitvec.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/test_bitvec.cpp') diff --git a/test/test_bitvec.cpp b/test/test_bitvec.cpp index 74c2e02..78a8272 100644 --- a/test/test_bitvec.cpp +++ b/test/test_bitvec.cpp @@ -246,6 +246,27 @@ test_comparison(Context&) } } +template +void +test_iteration(Context&) +{ + T v = make_zero_bitvec(); + size_t count = 0; + for (const auto bit : v) { + assert(!bit); + ++count; + } + // assert(count == N); + + v.flip(); + count = 0; + for (const auto bit : v) { + assert(bit); + ++count; + } + // assert(count == N); +} + template void test(Context& ctx) @@ -265,6 +286,7 @@ test(Context& ctx) test_find_first(ctx); test_gray_code(ctx); test_comparison(ctx); + test_iteration(ctx); } int -- cgit v1.2.1