diff options
author | Maximilian Bosch <[email protected]> | 2021-12-30 17:16:46 +0000 |
---|---|---|
committer | Maximilian Bosch <[email protected]> | 2021-12-30 17:16:46 +0000 |
commit | 794a795f525ee3587ce317e65b24935aeb9ba5cf (patch) | |
tree | c63bb7958ff1b9ca90d79ee25f193f5e1354366d | |
parent | a18e994ae5fc95761d4d3569a99d98dd4a99660b (diff) |
Implement a few more testcases
-rw-r--r-- | src/main.rs | 26 |
1 files changed, 26 insertions, 0 deletions
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 { | |||
264 | let evaled = eval_math_expression("e2", None).unwrap(); | 264 | let evaled = eval_math_expression("e2", None).unwrap(); |
265 | assert_eq!(5.4365636569, evaled); | 265 | assert_eq!(5.4365636569, evaled); |
266 | } | 266 | } |
267 | #[test] | ||
268 | fn eval_round() { | ||
269 | let evaled = eval_math_expression("round(0.5)+round(2.4)", None).unwrap(); | ||
270 | assert_eq!(3., evaled); | ||
271 | } | ||
272 | #[test] | ||
273 | fn eval_exp2() { | ||
274 | assert_eq!( | ||
275 | 256., | ||
276 | eval_math_expression("exp2(8)", None).unwrap() | ||
277 | ); | ||
278 | } | ||
279 | #[test] | ||
280 | fn eval_exp() { | ||
281 | assert_eq!( | ||
282 | 20.0855369232 as f64, | ||
283 | eval_math_expression("exp(3)", None).unwrap() | ||
284 | ); | ||
285 | } | ||
286 | #[test] | ||
287 | fn eval_e_times_n() { | ||
288 | assert_eq!( | ||
289 | 0. as f64, | ||
290 | eval_math_expression("e0", None).unwrap() | ||
291 | ); | ||
292 | } | ||
267 | } | 293 | } |