diff options
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/lambda.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/rust/src/lambda.rs b/rust/src/lambda.rs index a24b031..3c1c8b6 100644 --- a/rust/src/lambda.rs +++ b/rust/src/lambda.rs @@ -23,18 +23,22 @@ impl Display for Value { } } -fn interpret(_arg: &str) -> Value { - Value::Num(1) +fn interpret(arg: &str) -> Value { + Value::Num(arg.parse().unwrap()) } #[cfg(test)] mod tests { use super::interpret; use super::Value::Num; + // Bring the macros and other important things into scope. + use proptest::prelude::*; - #[test] - fn it_works() { - let result = interpret("1"); - assert_eq!(Num(1), result); + proptest! { + #[test] + fn interpret_integer_as_number(i in -1000i32..1000) { + let result = interpret(&i.to_string()); + assert_eq!(Num(i), result); + } } } |
