rust_template_test/
lib.rs

1use rand::Rng;
2
3pub fn rand_num() -> i32 {
4    rand::thread_rng().gen_range(1..=100)
5}
6
7#[cfg(test)]
8mod tests {
9    use super::*;
10
11    #[test]
12    fn test_rand_num() {
13        let num = rand_num();
14        assert!((1..=100).contains(&num));
15    }
16}