这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@mtl1979
Copy link
Collaborator

@mtl1979 mtl1979 commented Oct 6, 2025

  • compressed_sizes was unsigned long, but it was assigned size_t which is larger on MSVC
  • l0 and l1 are both uint16_t but rand() returns int which is 32-bit type

Summary by CodeRabbit

  • Tests
    • Made random data initialization explicit to avoid implicit casts in a benchmark, improving consistency.
    • Switched compressed size tracking to a larger integer type in another benchmark to prevent overflow and improve accuracy.
    • Enhances reliability and consistency of benchmark results across platforms.
    • No changes to runtime features; this affects only internal testing and does not impact end-user workflows.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Walkthrough

Minor benchmark test adjustments: add explicit uint16_t casts for random data initialization in slidehash benchmark, and change compressed_sizes array type from uLong to z_uintmax_t in uncompress benchmark. No control flow, allocation, or error handling changes.

Changes

Cohort / File(s) Summary
Benchmark casting fix
test/benchmarks/benchmark_slidehash.cc
Explicitly cast rand() results to uint16_t when assigning to l0[i] and l1[i]; no other logic changed.
Benchmark size type update
test/benchmarks/benchmark_uncompress.cc
Change member array type compressed_sizes from uLong to z_uintmax_t; usage unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Warnings fix, Testing Framework

Suggested reviewers

  • Dead2
  • nmoinvaz

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly identifies that the changes address cast and truncation warnings in the test code and accurately reflects the modifications in the benchmark files. It is concise, specific, and directly tied to the main goal of the pull request.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mtl1979
Copy link
Collaborator Author

mtl1979 commented Oct 6, 2025

@coderabbitai generate docstrings

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

✅ Actions performed

Docstrings generation started.

coderabbitai bot added a commit that referenced this pull request Oct 6, 2025
Docstrings generation was requested by @mtl1979.

* #1978 (comment)

The following files were modified:

* `test/benchmarks/benchmark_slidehash.cc`
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Note

Generated docstrings for this pull request at #1979

@Dead2 Dead2 changed the title Fix cast and truncation warnings. Tests: Fix cast and truncation warnings. Oct 7, 2025
@codecov
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (7d7db7a) to head (6b078ef).
⚠️ Report is 5 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #1978       +/-   ##
===========================================
- Coverage    80.86%       0   -80.87%     
===========================================
  Files          161       0      -161     
  Lines        13741       0    -13741     
  Branches      3117       0     -3117     
===========================================
- Hits         11111       0    -11111     
+ Misses        1603       0     -1603     
+ Partials      1027       0     -1027     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dead2 Dead2 merged commit a9ef3eb into zlib-ng:develop Oct 8, 2025
155 of 156 checks passed
Dead2 pushed a commit that referenced this pull request Oct 10, 2025
Docstrings generation was requested by @mtl1979.

* #1978 (comment)

The following files were modified:

* `test/benchmarks/benchmark_slidehash.cc`
@Dead2 Dead2 mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants