calculator_adrianovcar/lib.rs
1pub mod calc1;
2pub mod calc2;
3pub mod calc3;
4
5#[cfg(test)]
6mod tests {
7 use crate::calc1::add;
8 use crate::calc3::{power, logarithm};
9
10 #[test]
11 fn test_add() {
12 assert_eq!(add(2, 3), 5);
13 assert_eq!(add(u32::MAX, 0), u32::MAX); // Test overflow
14 }
15
16 #[test]
17 fn test_power() {
18 assert_eq!(power(2, 3), 8);
19 }
20
21 #[test]
22 fn test_log() {
23 assert_eq!(logarithm(2, 100), 6);
24 }
25}