diff options
author | Fredrik Meringdal <fmeringdal@hotmail.com> | 2020-11-01 22:56:06 +0100 |
---|---|---|
committer | Fredrik Meringdal <fmeringdal@hotmail.com> | 2020-11-01 22:56:06 +0100 |
commit | d28241cf589d2773bd3e28e05ca173c58561e913 (patch) | |
tree | 22acc45fa0de1aa100da69463d508d0c39d16bab /src/utils.rs | |
parent | 220c27fc152d8ad533e5450af2157b1061a47332 (diff) | |
download | rust_rrule-d28241cf589d2773bd3e28e05ca173c58561e913.zip |
docs + more tests
Diffstat (limited to 'src/utils.rs')
-rw-r--r-- | src/utils.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs index ef09d54..161e6c2 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -13,3 +13,25 @@ pub fn is_some_and_not_empty<T>(v: &Option<Vec<T>>) -> bool { None => false, } } + + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn python_mod(){ + assert_eq!(pymod(2, -3), -1); + assert_eq!(pymod(-2, 3), 1); + assert_eq!(pymod(-2, -3), -2); + assert_eq!(pymod(-3, -3), 0); + assert_eq!(pymod(3, 3), 0); + assert_eq!(pymod(2, 3), 2); + assert_eq!(pymod(4, 3), 1); + assert_eq!(pymod(3, 3), 0); + assert_eq!(pymod(6, 3), 0); + assert_eq!(pymod(-6, 3), 0); + assert_eq!(pymod(-6, -3), 0); + assert_eq!(pymod(6, -3), 0); + } +}
\ No newline at end of file |