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 {
|
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue