pub mod calc1;
pub mod calc2;

pub use calc1::*;
pub use calc2::*;

#[cfg(test)]
mod tests {
    use super::calc1::{add, sub};
    use super::calc2::{multiply, rate};

    #[test]
    fn test_add() {
        assert_eq!(add(10, 20), 30);
        assert_eq!(add(u32::MAX, 1), 0); // overflow wraps to 0
    }

    #[test]
    fn test_sub() {
        assert_eq!(sub(20, 10), 10);
        assert_eq!(sub(5, 10), 0); // no negative for u32
    }

    #[test]
    fn test_multiply() {
        assert_eq!(multiply(4, 5), 20);
        assert_eq!(multiply(0, 100), 0);
    }

    #[test]
    fn test_rate() {
        assert_eq!(rate(10, 2), 5);
        assert_eq!(rate(10, 0), 0); // division by zero returns 0
    }
}
