Skip to content

test(imgproc): move histogram module tests into src/imgproc/tests.rs - #119

Merged
kalwalt merged 1 commit into
devfrom
test/relocate-histogram-tests
Sep 2, 2026
Merged

test(imgproc): move histogram module tests into src/imgproc/tests.rs#119
kalwalt merged 1 commit into
devfrom
test/relocate-histogram-tests

Conversation

@kalwalt

@kalwalt kalwalt commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

Closes #111.

Every other imgproc submodule keeps its tests solely in the shared
src/imgproc/tests.rs, per the module structure convention in CLAUDE.md.
histogram.rs was the only one with its own embedded #[cfg(test)] mod tests block, left over from how #99 originally wrote it.

Mechanical move, no behavior change — all 33 histogram tests already went
through the public API with no dependency on private helpers, so they drop
straight into tests.rs's existing imgproc_tests module (which already
glob-imports crate::core::* and crate::imgproc::*) with no import
changes needed.

Test plan

  • Same 342 lib test count before and after — nothing lost or duplicated.
  • cargo test --workspace and cargo test --workspace --no-default-features --features std both pass.
  • cargo fmt --check / clippy -D warnings clean under --all-features
    and --no-default-features.

🤖 Generated with Claude Code

Every other imgproc submodule (color.rs, edge.rs, filter.rs, morph.rs,
pyramid.rs, threshold.rs, hough.rs, geometric.rs, resize.rs,
derivatives.rs, feature.rs) keeps its tests solely in the shared
src/imgproc/tests.rs, per the module structure convention in
CLAUDE.md. histogram.rs was the only one with its own embedded
#[cfg(test)] mod tests block, left over from how #99 originally wrote
it.

Mechanical move, no behavior change: all 33 histogram tests already
went through the public API (calc_hist, calc_back_project,
compare_hist, equalize_hist, Clahe/create_clahe, RangeSpec,
HistCompMethods) with no dependency on private helpers, so they drop
straight into tests.rs's existing imgproc_tests module (which already
glob-imports crate::core::* and crate::imgproc::*) with no import
changes needed.

Verified: same 342 lib test count before and after (nothing lost or
duplicated), passing under both default and
--no-default-features --features std, fmt/clippy clean under
--all-features and --no-default-features.

Closes #111

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Relocate histogram tests into the shared imgproc test module

🧪 Tests 🕐 Less than 10 minutes

Grey Divider

AI Description

• Consolidates 33 histogram tests in the shared imgproc test module.
• Exercises unchanged histogram behavior exclusively through public imgproc exports.
• Aligns histogram test organization with project module conventions.
Diagram

graph TD
  Runner["Cargo test"] --> Tests["Shared imgproc tests"] --> Api["Public imgproc API"] --> Histogram["Histogram implementation"]
Loading
High-Level Assessment

The direct relocation is optimal because the tests already use only public APIs and the shared module supplies the required imports. Retaining an embedded test module would preserve the existing inconsistency, while converting these to integration tests would unnecessarily broaden this organizational change.

Files changed (2) +630 / -639

Tests (2) +630 / -639
histogram.rsRemove the embedded histogram test module +0/-639

Remove the embedded histogram test module

• Removes the module-local test block so the file contains only histogram production code. No histogram implementation or public API behavior changes.

src/imgproc/histogram.rs

tests.rsCentralize histogram tests in the imgproc test suite +630/-0

Centralize histogram tests in the imgproc test suite

• Moves the existing histogram tests into the shared imgproc test module. Coverage remains focused on public APIs for histogram calculation, back projection, comparison, equalization, and CLAHE.

src/imgproc/tests.rs

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@kalwalt kalwalt self-assigned this Sep 2, 2026
@kalwalt kalwalt added enhancement New feature or request rust-code rust Pull requests that update rust code tests imgproc-module labels Sep 2, 2026
@kalwalt
kalwalt merged commit 991cdaf into dev Sep 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request imgproc-module rust Pull requests that update rust code rust-code tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant