Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement internal iteration for cartesian_product #92

Merged
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
fbb25d4
Change `STATIC_CHECK` to throw instead of returning false to improve
brycelelbach Jul 11, 2023
cc6067a
Don't add the `word_count` example to CTest, because it expects input…
brycelelbach Jul 11, 2023
c3d7880
`cartesian_product`: Implement internal iteration and rewrite random-…
brycelelbach Jul 11, 2023
070d607
Fix element type tests for `cartesian_product` of `ints` tests to use
brycelelbach Jul 12, 2023
be018dd
Add `cartesian_product` `for_each` tests, including one that validate…
brycelelbach Jul 12, 2023
ec1831e
Fix `cartesian_product::for_each_while` to pass a tuple of elements i…
brycelelbach Jul 12, 2023
53d051e
Add multidimensional memset vectorization benchmark.
brycelelbach Jul 12, 2023
8cb17a1
* Change `cartesian_product::ra_inc` to use checked numeric operations.
brycelelbach Jul 12, 2023
bce0c2f
Add `cartesian_product` `for_each_while` short circuiting test.
brycelelbach Jul 12, 2023
fdc6c43
Replace `cartesian_product_partial_cursor_t` with a cleaner form that…
brycelelbach Jul 12, 2023
b54ee9c
Update copyright notices.
brycelelbach Jul 12, 2023
4406237
Add `cartesian_product` empty sequence, 1D, and higher dimensional te…
brycelelbach Jul 12, 2023
6958d51
* Correct 2D memset benchmark to iterate in the right order for flux.
brycelelbach Jul 13, 2023
fe8ff5d
`s/drop/cartesian_product_tuple_drop/` in the `cartesian_product` imp…
brycelelbach Jul 13, 2023
42381ac
Correct element type tests for const 1D `cartesian_product`s.
brycelelbach Jul 13, 2023
abba492
Refactor `cartesian_product`'s `for_each_while_impl` to pass the curs…
brycelelbach Jul 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add cartesian_product for_each_while short circuiting test.
  • Loading branch information
brycelelbach committed Jul 31, 2023
commit bce0c2fe28a39e668d37571147ac1299c49a8165
12 changes: 12 additions & 0 deletions test/test_cartesian_product.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,18 @@ constexpr bool test_cartesian_product()
STATIC_CHECK(count_j == 4);
}

// `cartesian_product` `for_each_while` short circuits.
{
auto cart = flux::cartesian_product(std::array{100, 200}, std::array{300, 0});

int count = 0;
cart.for_each_while(flux::unpack([&] (auto i, auto j) {
++count;
return j != 0;
}));
STATIC_CHECK(count == 2);
}

// `cartesian_product` with a zero-sized sequence produces an empty sequence.

// `cartesian_product` with `unpack`.
Expand Down