Add an example use of the assert_eq macro

This commit is contained in:
Manuel Thalmann 2025-03-02 23:17:36 +01:00
parent 61f83d6de1
commit fcfa20a7e1

View file

@ -1,5 +1,5 @@
pub fn add(left: u64, right: u64) -> u64 { pub fn add_two(a: usize) -> usize {
left + right a + 2
} }
#[cfg(test)] #[cfg(test)]
@ -7,13 +7,8 @@ mod tests {
use super::*; use super::*;
#[test] #[test]
fn exploration() { fn it_adds_two() {
let result = add(2, 2); let result = add_two(2);
assert_eq!(result, 4); assert_eq!(result, 4);
} }
#[test]
fn another() {
panic!("Make this test fail");
}
} }