use compose::{compose_2, compose_n}; #[test] fn smoke_compose_2() { let add = |x| x + 1; let mul = |x| x * 2; let f1 = compose_2(add, mul); assert_eq!(5, f1(2)); let f2 = compose_2(mul, add); assert_eq!(6, f2(2)); } #[test] fn smoke_compose_n() { let add = |x| x + 1; let sub = |x| x - 1; let mul = |x| x * 2; let f1 = compose_n!(sub, add, mul); assert_eq!(4, f1(2)); let f2 = compose_n!(sub, mul, add); assert_eq!(5, f2(2)); }