feat: add CAST to fuzzer

This commit is contained in:
Levy A.
2025-09-24 16:37:35 -03:00
parent 85e0f1444d
commit 5dfd67b118
5 changed files with 60 additions and 19 deletions

View File

@@ -165,11 +165,21 @@ str_enum! {
}
}
str_enum! {
enum CastType {
Text => "text",
Real => "real",
Integer => "integer",
Numeric => "numeric",
}
}
#[derive(Debug, Arbitrary)]
enum Expr {
Value(Value),
Binary(Binary, Box<Expr>, Box<Expr>),
Unary(Unary, Box<Expr>),
Cast(Box<Expr>, CastType),
UnaryFunc(UnaryFunc, Box<Expr>),
BinaryFunc(BinaryFunc, Box<Expr>, Box<Expr>),
}
@@ -229,6 +239,14 @@ impl Expr {
depth: expr.depth + 1,
}
}
Expr::Cast(expr, cast_type) => {
let expr = expr.lower();
Output {
query: format!("cast({} as {cast_type})", expr.query),
parameters: expr.parameters,
depth: expr.depth + 1,
}
}
}
}
}