1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
pub fn adder(n1: i32, n2: i32) -> i32 {
println!("this is a new feature. well...");
println!("oh yes");
n1 + n2
}
#[cfg(test)]
mod tests {
use crate::adder::*;
#[test]
fn one_plus_two_is_three() {
let result = adder(1, 2);
assert_eq!(result, 3);
}
#[test]
fn one_plus_negative_one_is_zero() {
let result = adder(1, -1);
assert_eq!(result, 0);
}
}