From 2275ce14ee7bed99271fc8dc3dabab56d47a3138 Mon Sep 17 00:00:00 2001 From: Akshay Date: Tue, 5 May 2020 12:41:36 +0530 Subject: change name to cutlass --- tests/with_map.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/with_map.rs (limited to 'tests/with_map.rs') diff --git a/tests/with_map.rs b/tests/with_map.rs new file mode 100644 index 0000000..141ee5d --- /dev/null +++ b/tests/with_map.rs @@ -0,0 +1,33 @@ +#![feature(type_alias_impl_trait)] + +pub mod helper_functions { + use cutlass::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