From 794a795f525ee3587ce317e65b24935aeb9ba5cf Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Thu, 30 Dec 2021 18:16:46 +0100 Subject: Implement a few more testcases --- src/main.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main.rs b/src/main.rs index f5e5c59..e6a865e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -264,4 +264,30 @@ mod tests { let evaled = eval_math_expression("e2", None).unwrap(); assert_eq!(5.4365636569, evaled); } + #[test] + fn eval_round() { + let evaled = eval_math_expression("round(0.5)+round(2.4)", None).unwrap(); + assert_eq!(3., evaled); + } + #[test] + fn eval_exp2() { + assert_eq!( + 256., + eval_math_expression("exp2(8)", None).unwrap() + ); + } + #[test] + fn eval_exp() { + assert_eq!( + 20.0855369232 as f64, + eval_math_expression("exp(3)", None).unwrap() + ); + } + #[test] + fn eval_e_times_n() { + assert_eq!( + 0. as f64, + eval_math_expression("e0", None).unwrap() + ); + } } -- cgit v1.2.3