dummy_lib/lib.rs
1pub const fn times_two(num: i32) -> i64 {
2 let num = num as i64;
3 num.saturating_mul(2)
4}
5
6
7#[cfg(test)]
8mod tests {
9 use super::*;
10
11 #[test]
12 fn min_times_two() {
13 assert_eq!(times_two(i32::MIN), -4294967296);
14 }
15
16 #[test]
17 fn max_times_two() {
18 assert_eq!(times_two(i32::MAX), 4294967294);
19 }
20
21 #[test]
22 fn zero_times_two() {
23 assert_eq!(times_two(0), 0);
24 }
25}
26