1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::reactor::*;
impl<'a, S, T> Reactor<S> for &'a T
where
T: Reactor<S> + ?Sized,
{
type Output = T::Output;
fn react(&self, state: &S) -> Self::Output {
(**self).react(state)
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::mock::*;
use proptest::*;
proptest! {
#[test]
fn react(states: Vec<u8>) {
let reactor = &&Mock::default();
for (i, state) in states.iter().enumerate() {
assert_eq!(reactor.react(state), Ok(()));
assert_eq!(reactor, &&Mock::new(&states[0..=i]))
}
}
}
}