From 0d71915d5a9b65ae69dd3bd22f049ab4c9d583d6 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Tue, 2 Jan 2024 01:48:33 -0800 Subject: [PATCH] Add game of life --- Cargo.toml | 3 ++- game-of-life/Cargo.toml | 8 ++++++++ game-of-life/src/lib.rs | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 game-of-life/Cargo.toml create mode 100644 game-of-life/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 7a76adc..11902f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] resolver = "2" members = [ - "checkerboard" + "checkerboard", + "game-of-life", ] diff --git a/game-of-life/Cargo.toml b/game-of-life/Cargo.toml new file mode 100644 index 0000000..e7a5a94 --- /dev/null +++ b/game-of-life/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "game-of-life" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/game-of-life/src/lib.rs b/game-of-life/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/game-of-life/src/lib.rs @@ -0,0 +1,14 @@ +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); + } +}