Skip to content

Commit

Permalink
Fix uniqueness of rapidcheck 1d test
Browse files Browse the repository at this point in the history
  • Loading branch information
rroelke committed Feb 6, 2025
1 parent d9f7610 commit 8451b66
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions test/src/unit-sparse-global-order-reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3142,9 +3142,22 @@ struct Arbitrary<FxRun1D> {
auto dimension = gen::arbitrary<templates::Dimension<DIMENSION_TYPE>>();
auto allow_dups = gen::arbitrary<bool>();

auto domain =
gen::suchThat(gen::pair(allow_dups, dimension), [](const auto& domain) {
bool allow_dups;
templates::Dimension<DIMENSION_TYPE> dimension;
std::tie(allow_dups, dimension) = domain;
if (allow_dups) {
return true;
} else {
// need to ensure that rapidcheck uniqueness can generate enough
// cases
return dimension.domain.num_cells() >= 256;
}
});

auto fragments = gen::mapcat(
gen::pair(allow_dups, dimension),
[](std::pair<bool, templates::Dimension<DIMENSION_TYPE>> arg) {
domain, [](std::pair<bool, templates::Dimension<DIMENSION_TYPE>> arg) {
bool allow_dups;
templates::Dimension<DIMENSION_TYPE> dimension;
std::tie(allow_dups, dimension) = arg;
Expand Down

0 comments on commit 8451b66

Please sign in to comment.