From 3692f78ba00706dae9af0efc0b0087b5c3d16a07 Mon Sep 17 00:00:00 2001 From: Nicholas Novak <34256932+NickyBoy89@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:55:29 -0700 Subject: [PATCH] Added tests to project --- src/main.rs | 3 +++ src/storage/world.rs | 3 +++ src/tests/insert_one.rs | 7 +++++++ src/tests/mod.rs | 2 ++ 4 files changed, 15 insertions(+) create mode 100644 src/tests/insert_one.rs create mode 100644 src/tests/mod.rs diff --git a/src/main.rs b/src/main.rs index acb80af..fbb2b49 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,9 @@ mod storage; mod storage_server; use clap::Parser; +#[cfg(test)] +mod tests; + #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] struct Args { diff --git a/src/storage/world.rs b/src/storage/world.rs index d34130f..bd5b411 100644 --- a/src/storage/world.rs +++ b/src/storage/world.rs @@ -14,6 +14,9 @@ struct ChunkSection { /// section contains a 16 x 16 x 16 cube of blocks = 4096 blocks /// If the section is empty, this is skipped block_count: u16, + /// The data for all the blocks in the chunk + /// The representation for this may be different based on the number of + /// non-empty blocks block_states: [BlockID; 4096], } diff --git a/src/tests/insert_one.rs b/src/tests/insert_one.rs new file mode 100644 index 0000000..70912be --- /dev/null +++ b/src/tests/insert_one.rs @@ -0,0 +1,7 @@ +#[cfg(test)] +mod tests { + #[test] + fn add_one_block() { + assert_eq!(1, 1); + } +} diff --git a/src/tests/mod.rs b/src/tests/mod.rs new file mode 100644 index 0000000..9d5f059 --- /dev/null +++ b/src/tests/mod.rs @@ -0,0 +1,2 @@ +mod insert_one; +