1use super::{Generator, TestCase};
2
3pub fn unit() -> JustGenerator<()> {
6 just(())
7 }
9
10pub struct JustGenerator<T> {
12 value: T,
13}
14
15impl<T: Clone + Send + Sync> Generator<T> for JustGenerator<T> {
16 fn do_draw(&self, _tc: &TestCase) -> T {
17 self.value.clone()
18 }
19}
20
21pub fn just<T: Clone + Send + Sync>(value: T) -> JustGenerator<T> {
23 JustGenerator { value }
24}
25
26pub struct BoolGenerator;
28
29impl Generator<bool> for BoolGenerator {
30 fn do_draw(&self, tc: &TestCase) -> bool {
31 tc.generate_boolean(0.5)
32 }
33}
34
35pub fn booleans() -> BoolGenerator {
37 BoolGenerator
38}