sample_adder_topanisto 0.1.0

Practice with the Rust Book Ch14! Hello digital footprint!
Documentation
//! # Adder
//! 
//! Hello! This is the default `lib.rs` crate given by Rust with the function `add_two`. Hope you enjoy:)

/// Adds two to the given number!
/// 
/// # Examples
/// 
/// ```
/// let arg =5;
/// let answer = adder::add_two(arg);
/// assert_eq!(7, answer);
/// ```

pub fn add_two(left: i32) -> i32 {
    left + 2
}

#[cfg(test)] //tells Rust to only run this with cargo test, not cargo build
mod tests {
    use super::*;

    //we can run all of these tests with cargo test add
    #[test]
    fn add_2() {
        let result = add_two(2);
        assert_eq!(result, 4);
    }

    #[test]
    fn add_3() {
        let result = add_two(3);
        assert_eq!(result, 5);
    }

    #[test]
    #[ignore] //we can do this for particularly expensive tests
    // $ cargo test -- --ignored
    // to run all tests, use $ cargo test -- --include-ignored
    fn add_100() {
        let result = add_two(100);
        assert_eq!(result, 102);
    }
}