From ad5361cfbf0ed41ca87721ebe94fa3e8d1816ee4 Mon Sep 17 00:00:00 2001 From: timofey Date: Sun, 15 Oct 2023 14:18:22 +0000 Subject: [PATCH] lazy tests --- src/func/instances/lazy.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/func/instances/lazy.rs b/src/func/instances/lazy.rs index 66c5aec..ec8adae 100644 --- a/src/func/instances/lazy.rs +++ b/src/func/instances/lazy.rs @@ -102,3 +102,31 @@ impl<'a> Monad<'a> for LazyInstance { Box::new(|| ffa()()) } } + +#[cfg(test)] +mod lazy_tests { + use super::{test_suite, tests, LazyInstance}; + + type T = LazyInstance; + + impl<'a> tests::Eqr<'a> for T { + fn eqr( + name: &'a str, + left: Self::F, + right: Self::F, + ) -> tests::R { + tests::eqr(name, left(), right()) + } + } + + impl<'a> test_suite::FunctorTestSuite<'a> for T { + fn sample Self::F))>(mut f: F) { + f(&|a| Box::new(|| a)); + } + } + + #[test] + fn monad_follows_laws() { + test_suite::monad_follows_laws::().unwrap(); + } +}