diff options
Diffstat (limited to 'rust/src/lambda.rs')
| -rw-r--r-- | rust/src/lambda.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rust/src/lambda.rs b/rust/src/lambda.rs index 406aebf..e6102d8 100644 --- a/rust/src/lambda.rs +++ b/rust/src/lambda.rs @@ -114,6 +114,7 @@ pub fn generate_expr(size: u32, runner: &mut TestRunner) -> Value { 3 => any_sym().new_tree(runner).unwrap().current(), 4 => simple_app().new_tree(runner).unwrap().current(), 5 => nested_simple_app().new_tree(runner).unwrap().current(), + 6 => simple_lambda().new_tree(runner).unwrap().current(), _ => todo!(), } } @@ -128,7 +129,7 @@ fn any_num() -> impl Strategy<Value = Value> { } fn nested_simple_app() -> impl Strategy<Value = Value> { - let leaf = prop_oneof![any_num(), any_sym()]; + let leaf = prop_oneof![any_num(), ascii_identifier().prop_map(Value::Sym)]; leaf.prop_recursive(4, 128, 5, move |inner| { (inner.clone(), inner.clone()).prop_map(|(l, r)| Value::App(Box::new(l), Box::new(r))) }) @@ -138,6 +139,10 @@ fn any_sym() -> impl Strategy<Value = Value> { identifier().prop_map(Value::Sym) } +fn simple_lambda() -> impl Strategy<Value = Value> { + (ascii_identifier(), nested_simple_app()).prop_map(|(v, b)| Value::Lam(v, Box::new(b))) +} + #[cfg(test)] mod lambda_test { use crate::parser::parse; |
