Update listings subsequent to listing 11-1 to reflect current content

This commit is contained in:
Jon Earnshaw 2023-02-07 04:49:10 +00:00
parent b2365a3f08
commit bb7aa19d9d
2 changed files with 17 additions and 3 deletions

View File

@ -1,11 +1,18 @@
// ANCHOR: here
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn exploration() {
assert_eq!(2 + 2, 4);
let result = add(2, 2);
assert_eq!(result, 4);
}
#[test]
fn another() {
panic!("Make this test fail");

View File

@ -1,7 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn exploration() {
assert_eq!(2 + 2, 4);
let result = add(2, 2);
assert_eq!(result, 4);
}
}