feat: add roll method to Dice
This commit is contained in:
20
01.workspace/oxydice_lib/src/tst/dice_roll.rs
Normal file
20
01.workspace/oxydice_lib/src/tst/dice_roll.rs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
pub mod dice_grab;
|
||||
pub mod dice_roll;
|
||||
|
||||
Reference in New Issue
Block a user