diff --git a/src/data/mod.rs b/src/data/mod.rs index d0c2d0d..4f09ac0 100644 --- a/src/data/mod.rs +++ b/src/data/mod.rs @@ -15,6 +15,7 @@ struct IDPath { impl IDPath { fn new() -> Self { let mut path = Vec::new(); + path.push(Uuid::nil()); Self { path: path } } @@ -24,7 +25,9 @@ impl IDPath { fn extend(&self, addition: Uuid) -> Self { let mut result = self.clone(); + result.path.pop(); result.path.push(addition); + result.path.push(Uuid::nil()); result } @@ -39,8 +42,9 @@ mod ids { #[test] fn create_idpath() { + let expected = [Uuid::nil()]; let id = IDPath::new(); - assert_eq!(id.path.len(), 0); + assert_eq!(id.path, expected); } #[test] @@ -56,20 +60,18 @@ mod ids { #[test] fn extend_idpath() { let mut path: Vec = Vec::new(); + path.push(Uuid::nil()); let mut id = IDPath::new(); - for _ in 1..5 { + for count in 1..5 { + assert_eq!(id.path.len(), count); let extended = IDPath::next(); id = id.extend(extended.clone()); + path.pop(); path.push(extended); + path.push(Uuid::nil()); assert_eq!(id.path, path); } } - - #[test] - fn get_root() { - let mut id = IDPath::new(); - id.root(); - } } struct Cache {