use spg_engine::{Engine, QueryResult};
fn b(e: &mut Engine, sql: &str) -> bool {
match e.execute(sql).unwrap() {
QueryResult::Rows { rows, .. } => match &rows[0].values[0] {
spg_storage::Value::Bool(v) => *v,
v => panic!("expected bool, got {v:?}"),
},
_ => panic!("expected rows"),
}
}
#[test]
fn tsquery_equality_is_structural() {
let mut e = Engine::new();
assert!(b(&mut e, "SELECT ('a & b'::tsquery = 'a & b'::tsquery)"));
assert!(!b(&mut e, "SELECT ('a & b'::tsquery = 'b & a'::tsquery)"));
assert!(b(&mut e, "SELECT ('a & b'::tsquery <> 'a & c'::tsquery)"));
assert!(b(
&mut e,
"SELECT (plainto_tsquery('simple','a b') = plainto_tsquery('simple','a b'))"
));
}