| 555 | /// Exercise the limit [`recursion::MAX_RECURSION_TYP_EXPR`] |
| 556 | #[test] |
| 557 | fn typing_recursion() { |
| 558 | let build_query = |total, sep: char| { |
| 559 | let mut expr = SqlExpr::Lit(SqlLiteral::Bool(true)); |
| 560 | for _ in 1..total { |
| 561 | let next = SqlExpr::Log( |
| 562 | Box::new(SqlExpr::Lit(SqlLiteral::Bool(true))), |
| 563 | Box::new(SqlExpr::Lit(SqlLiteral::Bool(false))), |
| 564 | LogOp::And, |
| 565 | ); |
| 566 | expr = SqlExpr::Log(Box::new(expr), Box::new(next), LogOp::And); |
| 567 | } |
| 568 | type_expr(&Relvars::default(), expr, Some(&AlgebraicType::Bool)) |
| 569 | .map_err(|e| e.to_string().split(sep).next().unwrap_or_default().to_string()) |
| 570 | }; |
| 571 | assert_eq!(build_query(2_501, ','), Err("Recursion limit exceeded".to_string())); |
| 572 | |
| 573 | assert!(build_query(2_500, ',').is_ok()); |
| 574 | } |
| 575 | |
| 576 | #[test] |
| 577 | fn views() { |