Skip to content

test: add comprehensive test coverage for Rust modules#49

Merged
corybuecker merged 1 commit into
mainfrom
corybuecker/bue-107-add-test-coverage-to-rust
Jul 26, 2025
Merged

test: add comprehensive test coverage for Rust modules#49
corybuecker merged 1 commit into
mainfrom
corybuecker/bue-107-add-test-coverage-to-rust

Conversation

@corybuecker
Copy link
Copy Markdown
Owner

@corybuecker corybuecker commented Jul 26, 2025

  • Add extensive unit tests for mathematics module (mean, median functions)
  • Add comprehensive test coverage for dispersion module (variance, stdev, percentile)
  • Include edge case tests for empty arrays, NaN, infinity, and large datasets
  • Add rb-sys-test-helpers dependency for Rust testing infrastructure
  • Integrate Rust testing into GitHub Actions CI workflow
  • Remove unused build.rs file and update Cargo.toml dependencies

@corybuecker corybuecker force-pushed the corybuecker/bue-107-add-test-coverage-to-rust branch from fb4c91a to 4bb1bfd Compare July 26, 2025 12:02
@corybuecker corybuecker changed the title Add test coverage for Rust modules test: add comprehensive test coverage for Rust modules Jul 26, 2025
@corybuecker corybuecker marked this pull request as ready for review July 26, 2025 12:02
Copilot AI review requested due to automatic review settings July 26, 2025 12:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive test coverage for Rust modules in the ruby_native_statistics gem. It introduces Rust testing infrastructure to the CI workflow and adds extensive unit and integration tests.

  • Added Rust testing support to GitHub Actions workflow
  • Added comprehensive unit tests for mathematical functions with edge cases
  • Cleaned up build configuration by removing unused build.rs file

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ext/ruby_native_statistics/src/mathematics.rs Added 20+ unit tests covering mean/median calculations, edge cases, and integration tests
ext/ruby_native_statistics/src/dispersion.rs Added comprehensive tests for variance, standard deviation, and percentile calculations
ext/ruby_native_statistics/build.rs Removed unused build.rs file entirely
ext/ruby_native_statistics/Cargo.toml Updated dependencies and added test-specific dependencies
.github/workflows/branch-protection.yaml Added Rust toolchain setup and cargo test command
Comments suppressed due to low confidence (3)

ext/ruby_native_statistics/Cargo.toml:13

  • The version "0.1" for rb-sys-env in dev-dependencies conflicts with version "0.2" in build-dependencies. This version downgrade in dev-dependencies may indicate a non-existent or incompatible version.
rb-sys-env = { version = "0.1" }

ext/ruby_native_statistics/src/mathematics.rs:100

  • Missing test coverage for calculate_mean with empty array. The test only covers calculate_median with empty arrays, but calculate_mean would panic with division by zero on empty input.
    fn test_calculate_median_empty_array() {

ext/ruby_native_statistics/src/mathematics.rs:167

  • The NaN test is incomplete - it only verifies that the function doesn't panic but doesn't test the actual behavior. Consider asserting the specific expected result or behavior when NaN values are present.
        let result = calculate_median(&[1.0, f64::NAN, 3.0]);

Comment thread ext/ruby_native_statistics/src/mathematics.rs
@corybuecker corybuecker force-pushed the corybuecker/bue-107-add-test-coverage-to-rust branch from 4bb1bfd to 1df1bca Compare July 26, 2025 12:10
- Add extensive unit tests for mathematics module (mean, median functions)
- Add comprehensive test coverage for dispersion module (variance, stdev, percentile)
- Include edge case tests for empty arrays, NaN, infinity, and large datasets
- Add rb-sys-test-helpers dependency for Rust testing infrastructure
- Integrate Rust testing into GitHub Actions CI workflow
- Remove unused build.rs file and update Cargo.toml dependencies
@corybuecker corybuecker force-pushed the corybuecker/bue-107-add-test-coverage-to-rust branch from 1df1bca to e5ec873 Compare July 26, 2025 12:15
@corybuecker corybuecker merged commit 5da12cf into main Jul 26, 2025
9 checks passed
@corybuecker corybuecker deleted the corybuecker/bue-107-add-test-coverage-to-rust branch July 26, 2025 12:16
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