From fcfa20a7e12ea8d6a5a025c6583add48e26ae235 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 2 Mar 2025 23:17:36 +0100 Subject: [PATCH] Add an example use of the `assert_eq` macro --- adder/src/lib.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/adder/src/lib.rs b/adder/src/lib.rs index 336ea08..682e8ae 100644 --- a/adder/src/lib.rs +++ b/adder/src/lib.rs @@ -1,5 +1,5 @@ -pub fn add(left: u64, right: u64) -> u64 { - left + right +pub fn add_two(a: usize) -> usize { + a + 2 } #[cfg(test)] @@ -7,13 +7,8 @@ mod tests { use super::*; #[test] - fn exploration() { - let result = add(2, 2); + fn it_adds_two() { + let result = add_two(2); assert_eq!(result, 4); } - - #[test] - fn another() { - panic!("Make this test fail"); - } }