From 3efc84e557e74d131993804a2829b6e66c2807cc Mon Sep 17 00:00:00 2001 From: Akshay Date: Tue, 5 May 2020 12:11:35 +0530 Subject: add smoke tests --- tests/smoke.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/smoke.rs diff --git a/tests/smoke.rs b/tests/smoke.rs new file mode 100644 index 0000000..059cf9f --- /dev/null +++ b/tests/smoke.rs @@ -0,0 +1,33 @@ +#![feature(type_alias_impl_trait)] + +pub mod helper_functions { + use currying::curry; + + #[curry] + pub fn product(x: u32, y: u32) -> u32 { + return x * y; + } + #[curry] + pub fn add(x: u32, y: u32) -> u32 { + x + y + } +} + +#[cfg(test)] +mod tests { + use super::helper_functions::{add, product}; + #[test] + fn test_product() { + assert_eq!( + (1..=3).map(product(5)).collect::>(), + vec![5, 10, 15] + ); + } + + #[test] + fn test_add() { + let increment = add(1); + let v: Vec = (1..=3).map(increment).collect(); + assert_eq!(v, vec![2, 3, 4]); + } +} -- cgit v1.2.3