From eb5a0f1344b5287f3280edd964cccef2df5b4aa1 Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Tue, 23 Jun 2020 16:23:24 +0100 Subject: [PATCH] test new_unique_id() --- src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 387f566..1795a02 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -185,7 +185,7 @@ impl Unquote for String { #[cfg(test)] mod test { - use crate::{from_base36, ToBase36, optional_data_line, mock, segments_from_string, Quote, Unquote}; + use crate::{from_base36, ToBase36, optional_data_line, mock, segments_from_string, Quote, Unquote, new_unique_id}; #[test] fn test_from_base36() { @@ -234,4 +234,11 @@ mod test { let expected = "who the fuck is scraeming \"LOG OFF\" at my house.\nshow yourself, coward.\ni will never log off".to_string(); assert_eq!(output, expected); } + + #[test] + fn test_new_unique_id() { + assert_eq!(new_unique_id(vec!["0".to_string(), "2".to_string()]), "1".to_string()); + assert_eq!(new_unique_id(vec!["0".to_string(), "1".to_string()]), "2".to_string()); + assert_eq!(new_unique_id(vec!["1".to_string(), "z".to_string()]), "0".to_string()); + } }