feat: add roll method to Dice

This commit is contained in:
2025-11-15 12:41:41 +01:00
parent dd22385aff
commit f1dfbb0fff
11 changed files with 58 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
#[cfg(test)]
mod tests {
use crate::*;
#[test]
pub fn dice_roll_should_yield_always_the_proper_number_of_result() {
let mut dice = Dice::grab(3, 6);
for _ in 1..=1000 {
dice.roll();
assert_eq!(dice.result.die_results.len(), 3);
}
}
#[test]
pub fn dice_roll_should_yield_valid_results() {
let mut dice = Dice::grab(3, 6);
for _ in 1..=10000 {
dice.roll();
assert!(dice.result.die_results[0] < 6);
}
}
}

View File

@@ -1 +1,2 @@
pub mod dice_grab;
pub mod dice_roll;