1pub fn add(left: u64, right: u64) -> u64 {
2 left + right
3}
4
5pub mod calc1;
6pub mod calc2;
7pub mod calc3;
8
9#[cfg(test)]
10mod tests {
11 use std::u32;
12
13 use super::calc1::{add as add32, sub};
14 use super::calc2::{multiply, rate};
15 use super::calc3::{power, log};
16
17 #[test]
18 fn test_add() {
19 assert_eq!(add32(10, 20), 30);
20 assert_eq!(add32(u32::MAX, 1), u32::MAX); }
22
23 #[test]
24 fn test_sub() {
25 assert_eq!(sub(10, 4), 6);
26 assert_eq!(sub(4, 10), 0); }
28
29 #[test]
30 fn test_multiply() {
31 assert_eq!(multiply(3, 5), 15);
32 }
33
34 #[test]
35 fn test_rate() {
36 assert_eq!(rate(20, 4), 5);
37 assert_eq!(rate(10, 0), 0); }
39}