Skip to content

Expand radix sort regression coverage - #20

Merged
JCash merged 7 commits into
devfrom
radix-sort-regression-tests
Nov 26, 2026
Merged

JCash merged 7 commits into
devfrom
radix-sort-regression-tests

Conversation

@JCash

@JCash JCash commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

The existing 64-bit test draws its keys from rand(), leaving the upper bits constant. The struct test also feeds partially sorted records into its second sort. Both cases can hide a skipped radix pass.

  • Key ordering. Exercise all 64 bit positions, zero, and the two largest uint64_t values. Compare the complete result with std::sort.
  • Record stability. Give each sort fresh input and scratch storage. Compare two- and three-byte prefix sorts with std::stable_sort on 7 and 64 records, using distinct payloads to detect reordered ties.
  • Range boundaries. Check empty and singleton ranges through both entry points. Use distinct input and scratch guards to detect a sort that includes an extra record.

This branch includes the CI prerequisite from #21. It updates jctest to v0.15 with fixes for POSIX death tests and array-comparison diagnostics, and runs the Build workflow on the proposed merge. The two branches differ only in test/algorithm.cpp. CI prerequisite

Verification

  • Reproduced the bitarray failure on Ubuntu 26.04 with glibc 2.43. With the fix, all 56 tests passed on Ubuntu 26.04 and arm64 macOS, including both bitarray out-of-bounds cases.
  • All 56 tests passed with AddressSanitizer and UndefinedBehaviorSanitizer enabled on arm64 macOS using the v0.15 headers.
  • In temporary builds, the tests caught precision loss between the two largest keys and reported unstable ordering at both prefix widths in one run.
  • The proposed merge passed Linux, macOS, and both Windows builds. CodeQL reported no new alerts. Merge build · CodeQL check
  • The existing pull_request_target workflow ran dev at 268b7c1, where the bitarray test still aborts. Base-branch job

Import jc_test.h and jc_test.hpp from JCash/jctest at 46d4975985135b66e7bce7de39875e05380df5b4. Carry the POSIX death-test signal-mask fix into the C++ header. Match ring-buffer size and capacity expectations to their unsigned return type.

(cherry picked from commit e42a3ee)
Comment thread test/jc_test.hpp Fixed
Comment thread test/jc_test.hpp Fixed
Comment thread test/jc_test.hpp Fixed
Comment thread test/jc_test.hpp Fixed
Comment thread test/jc_test.hpp Fixed
Comment thread test/jc_test.hpp Fixed
Comment thread test/jc_test.hpp Fixed
Comment thread test/jc_test.hpp Fixed
Comment thread test/jc_test.hpp Fixed
Comment thread test/jc_test.hpp Fixed
Format mismatched arrays with the existing growable string so truncated snprintf output cannot advance beyond a buffer.

(cherry picked from commit dc0ce8b)
@JCash
JCash merged commit 1e4414a into dev Nov 26, 2026
15 of 16 checks passed
@JCash
JCash deleted the radix-sort-regression-tests branch November 26, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants