lazy tests
All checks were successful
buildbot/cargo fmt (1.72) Build done.
buildbot/cargo doc (1.72) Build done.
buildbot/cargo clippy (1.72) Build done.
buildbot/cargo test (1.65) Build done.
buildbot/cargo clippy (1.65) Build done.

This commit is contained in:
AF 2023-10-15 14:18:22 +00:00
parent 655e33768f
commit ad5361cfbf

View File

@ -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<A: 'a + Send + PartialEq + std::fmt::Debug>(
name: &'a str,
left: Self::F<A>,
right: Self::F<A>,
) -> tests::R {
tests::eqr(name, left(), right())
}
}
impl<'a> test_suite::FunctorTestSuite<'a> for T {
fn sample<A: 'a + Send, F: FnMut(&'a (dyn Send + Sync + Fn(A) -> Self::F<A>))>(mut f: F) {
f(&|a| Box::new(|| a));
}
}
#[test]
fn monad_follows_laws() {
test_suite::monad_follows_laws::<T>().unwrap();
}
}