From 4ceba40899d39cdca5452fc4a6a96c9e24bf268c Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Sat, 1 Oct 2022 16:14:00 -0400 Subject: [PATCH] add_one fn --- src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/lib.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..d751034 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,19 @@ +#[no_mangle] +pub extern "C" fn add_one(x: u32) -> u32 { + x + 1 +} + +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +}