Add an example use of the assert_eq
macro
This commit is contained in:
parent
61f83d6de1
commit
fcfa20a7e1
1 changed files with 4 additions and 9 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue