()
| 508 | |
| 509 | #[test] |
| 510 | fn simple_arithmetic() { |
| 511 | let (expr, deps) = parse_ok("price * (1 + tax_rate)"); |
| 512 | assert_eq!(deps, vec!["price", "tax_rate"]); |
| 513 | let doc = Value::from(serde_json::json!({"price": 100.0, "tax_rate": 0.08})); |
| 514 | let result = expr.eval(&doc); |
| 515 | assert_eq!(result.as_f64(), Some(108.0)); |
| 516 | } |
| 517 | |
| 518 | #[test] |
| 519 | fn round_function() { |