aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-05-05 07:41:35 +0100
committerAkshay <[email protected]>2020-05-05 07:41:35 +0100
commit3efc84e557e74d131993804a2829b6e66c2807cc (patch)
tree2d1bd1b43aa71cdad62e90a0bf5a9dac90c42e07
parentb63710492fdbdcaa66054e6eec120a2ac8211f99 (diff)
add smoke tests
-rw-r--r--tests/smoke.rs33
1 files changed, 33 insertions, 0 deletions
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 @@
1#![feature(type_alias_impl_trait)]
2
3pub mod helper_functions {
4 use currying::curry;
5
6 #[curry]
7 pub fn product(x: u32, y: u32) -> u32 {
8 return x * y;
9 }
10 #[curry]
11 pub fn add(x: u32, y: u32) -> u32 {
12 x + y
13 }
14}
15
16#[cfg(test)]
17mod tests {
18 use super::helper_functions::{add, product};
19 #[test]
20 fn test_product() {
21 assert_eq!(
22 (1..=3).map(product(5)).collect::<Vec<u32>>(),
23 vec![5, 10, 15]
24 );
25 }
26
27 #[test]
28 fn test_add() {
29 let increment = add(1);
30 let v: Vec<u32> = (1..=3).map(increment).collect();
31 assert_eq!(v, vec![2, 3, 4]);
32 }
33}