start of testing chapter

This commit is contained in:
Rowan Torbitzky-Lane 2025-03-28 21:43:05 -05:00
parent e840d912d1
commit b571a7be8b
3 changed files with 28 additions and 0 deletions

7
ch11/adder/Cargo.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "adder"
version = "0.1.0"

6
ch11/adder/Cargo.toml Normal file
View File

@ -0,0 +1,6 @@
[package]
name = "adder"
version = "0.1.0"
edition = "2021"
[dependencies]

15
ch11/adder/src/lib.rs Normal file
View File

@ -0,0 +1,15 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
// #[test] indicates this is a test function
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}