chore: add unit test to validate benchmark code#72
Merged
nyurik merged 5 commits intofast-pack:mainfrom Mar 18, 2026
Merged
Conversation
for more information, see https://pre-commit.ci
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the Criterion benchmark suite to share data generators/fixtures via a new benches/bench_utils.rs module, and adds a smoke-test suite so benchmark code paths are exercised by cargo test (useful for coverage without Criterion overhead).
Changes:
- Added
benches/bench_utils.rswith shared generators, codec helpers, and precomputed fixtures. - Refactored
benches/fastpfor_benchmark.rsto consume those fixtures instead of duplicating logic. - Added
tests/benchmark_smoke.rsto run each benchmark path once undercargo test, and updatedCargo.tomlbench configuration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
tests/benchmark_smoke.rs |
New smoke tests that run benchmark helper paths once for coverage. |
benches/bench_utils.rs |
New shared module providing generators, helpers, and fixtures for benches/tests. |
benches/fastpfor_benchmark.rs |
Benchmarks now use shared fixtures; roundtrip and cpp-vs-rust paths updated accordingly. |
Cargo.toml |
Adds an additional bench target entry related to bench_utils. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
76
to
83
| @@ -252,48 +82,32 @@ fn benchmark_roundtrip(c: &mut Criterion) { | |||
| &mut output_offset, | |||
| ) | |||
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.