Skip to content

Commit

Permalink
test(tests): ✅ update test_poisson to remove redundant comparison a…
Browse files Browse the repository at this point in the history
…nd validate result range
  • Loading branch information
sebastienrousseau committed Aug 26, 2024
1 parent c0a5801 commit c8784c5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/test_random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,17 @@ mod tests {

Check failure on line 301 in tests/test_random.rs

View workflow job for this annotation

GitHub Actions / Format

Diff in /home/runner/work/vrd/vrd/tests/test_random.rs
/// Tests the `poisson` method to ensure it generates numbers from a Poisson distribution.
#[test]
fn test_poisson() {
let mut rng = Random::new();
rng.seed(42);
let result = rng.poisson(3.0);
assert!(result > 0);
}
fn test_poisson() {
let mut rng = Random::new();
rng.seed(42);
let result = rng.poisson(3.0);

// Ensure that the result is within a reasonable range given the mean
// For a mean of 3.0, values are likely to be between 0 and some reasonable upper bound.
// You might adjust this based on specific requirements.
assert!(result < 20);
}


// String generation tests
/// Tests the `string` method to ensure it generates a string of the specified length.
Expand Down

0 comments on commit c8784c5

Please sign in to comment.