tests(algorithms): ensure cross-policy consistency and add missing edge cases#7175
Conversation
|
Can one of the admins verify this patch? |
Up to standards ✅🟢 Issues
|
50e3a9d to
e1239e0
Compare
|
@aneek22112007-tech Please have a look at the inspect issues reported. |
e1239e0 to
d27bc0d
Compare
@hkaiser Thanks for catching that! The inspect issue was caused by some non-ASCII em-dashes (—) in my code comments. I've stripped them out and forced an update to the branch. The inspect checks should be green now! |
d27bc0d to
8c687ea
Compare
…ion tests - hpx::find: add test_find_cross_policy covering 7 deterministic datasets (empty range, single element match/no-match, boundary-0, boundary-N, no match anywhere, multiple matches) across seq/par/par_unseq - hpx::find_if: add test_find_if_cross_policy with identical 7-dataset harness; remove stale debug std::cout left in test_find_if_async - hpx::find_first_of: add test_find_first_of_empty_needle verifying the C++ standard mandate that an empty needle range returns first (exercised per policy); add test_find_first_of_cross_policy as a direct regression guard for the historical inner-loop non-short-circuit bug - hpx::mismatch: add test_mismatch_cross_policy extending empty-range coverage from the HPX_HAVE_STDEXEC-only sender path to seq/par/par_unseq - hpx::experimental::reduce_by_key: add three boundary condition tests: empty input, single key group (all keys identical), all-unique keys No API or implementation changes. Pure test additions.
6aeebc8 to
191eb2a
Compare
|
@aneek22112007-tech inspect is still not happy: |
191eb2a to
5fdcbcd
Compare
5fdcbcd to
66175f1
Compare
@hkaiser Good catch! I missed the <type_traits> header for std::is_same_v when I pulled out the edge case tests earlier. I've just added the include and forced an update. Hopefully, inspect is happy this time! |
While working on the recent
find_first_ofearly-termination fix, I noticed that our test suite doesn't explicitly verify thatseq,par, andpar_unseqreturn identical results for the exact same inputs. It also missed a few basic boundary conditions (like the "not found" path for parallel execution).This PR adds some straightforward regression tests to make sure the standard execution policies never diverge from the sequential behavior. No API or implementation logic was changed.
Changes:
find&find_if: Added a cross-policy helper that checks 7 deterministic scenarios (empty range, single element, partition boundaries, complete miss, and multiple matches). Also removed a leftoverstd::coutdebug print infindif_tests.hpp.find_first_of: Added standard-compliance checks for empty needle ranges. Added a cross-policy test that acts as a direct regression guard for the recent inner-loop short-circuiting bug.mismatch: The empty-range test was previously only running under theHPX_HAVE_STDEXECsender path. Extended this to run forseq,par, andpar_unseq.reduce_by_key: Added basic boundary tests for empty inputs, all-identical keys (single group), and all-unique keys.These additions should give us a bit more confidence when tweaking or optimizing the parallel algorithm implementations in the future.