Skip to main content

calculator_washinribeiro/
lib.rs

1pub mod calc1;
2pub mod calc2;
3pub mod calc3;
4
5#[cfg(test)]
6mod tests {
7    use super::calc1::{add, sub};
8    use super::calc2::{multiply, rate};
9    use super::calc3::{pot, log};
10
11    #[test]
12    fn teste_add() {
13        assert_eq!(add(10, 20), 30);
14    }
15
16    #[test]
17    fn teste_sub() {
18        assert_eq!(sub(20, 10), 10);
19    }
20
21    #[test]
22    fn teste_multiply() {
23        assert_eq!(multiply(2, 3), 6);
24    }
25
26    #[test]
27    fn teste_rate() {
28        assert_eq!(rate(100, 5), 20);
29    }
30
31    #[test]
32    fn teste_pot() {
33        assert_eq!(pot(2, 3), 8);
34    }
35
36    #[test]
37    fn teste_log() {
38        assert_eq!(log(3, 6561), Some(8));
39    }
40
41}