()
| 541 | |
| 542 | #[test] |
| 543 | fn case_when() { |
| 544 | let (expr, deps) = |
| 545 | parse_ok("CASE WHEN discount > 0 THEN price * (1 - discount) ELSE price END"); |
| 546 | assert!(deps.contains(&"discount".to_string())); |
| 547 | assert!(deps.contains(&"price".to_string())); |
| 548 | |
| 549 | let doc = Value::from(serde_json::json!({"price": 100.0, "discount": 0.2})); |
| 550 | assert_eq!(expr.eval(&doc).as_f64(), Some(80.0)); |
| 551 | |
| 552 | let doc2 = Value::from(serde_json::json!({"price": 100.0, "discount": 0})); |
| 553 | assert_eq!(expr.eval(&doc2).as_f64(), Some(100.0)); |
| 554 | } |
| 555 | |
| 556 | #[test] |
| 557 | fn rejects_now() { |
nothing calls this directly
no test coverage detected