summaryrefslogtreecommitdiffstats
path: root/CLI/rust/src/game_of_life/opts.rs
diff options
context:
space:
mode:
Diffstat (limited to 'CLI/rust/src/game_of_life/opts.rs')
-rw-r--r--CLI/rust/src/game_of_life/opts.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/CLI/rust/src/game_of_life/opts.rs b/CLI/rust/src/game_of_life/opts.rs
index 5e52715..a0ed34b 100644
--- a/CLI/rust/src/game_of_life/opts.rs
+++ b/CLI/rust/src/game_of_life/opts.rs
@@ -46,4 +46,24 @@ pub(crate) mod validators {
Err(e) => Err(e.to_string()),
}
}
+
+ #[cfg(test)]
+ mod is_positive {
+ use super::*;
+
+ #[test]
+ fn positive_value() {
+ assert!(is_positive("1337").is_ok());
+ }
+
+ #[test]
+ fn negative_value() {
+ assert!(is_positive("-1337").is_err());
+ }
+
+ #[test]
+ fn string_value() {
+ assert!(is_positive("not a number").is_err());
+ }
+ }
}