mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
tests/fuzz: make compound key fuzz test a bit stricter with ordering
This commit is contained in:
parent
1189b7a288
commit
95bc644244
1 changed files with 21 additions and 7 deletions
|
@ -387,13 +387,27 @@ mod tests {
|
|||
// so we need to check that limbo and sqlite return the same results when the ordering is reversed.
|
||||
// because we are generally using LIMIT (to make the test complete faster), we need to rerun the query
|
||||
// without limit and then check that the results are the same if reversed.
|
||||
let query_no_limit =
|
||||
format!("SELECT * FROM t {} {} {}", where_clause, order_by, "");
|
||||
let limbo_no_limit = limbo_exec_rows(&dbs[i], &limbo_conns[i], &query_no_limit);
|
||||
let sqlite_no_limit = sqlite_exec_rows(&sqlite_conn, &query_no_limit);
|
||||
let limbo_rev = limbo_no_limit.iter().cloned().rev().collect::<Vec<_>>();
|
||||
if limbo_rev == sqlite_no_limit {
|
||||
continue;
|
||||
let order_by_only_equalities = !order_by_components.is_empty()
|
||||
&& order_by_components.iter().all(|o: &String| {
|
||||
if o.starts_with("x ") {
|
||||
comp1.map_or(false, |c| c == "=")
|
||||
} else if o.starts_with("y ") {
|
||||
comp2.map_or(false, |c| c == "=")
|
||||
} else {
|
||||
comp3.map_or(false, |c| c == "=")
|
||||
}
|
||||
});
|
||||
|
||||
if order_by_only_equalities {
|
||||
let query_no_limit =
|
||||
format!("SELECT * FROM t {} {} {}", where_clause, order_by, "");
|
||||
let limbo_no_limit =
|
||||
limbo_exec_rows(&dbs[i], &limbo_conns[i], &query_no_limit);
|
||||
let sqlite_no_limit = sqlite_exec_rows(&sqlite_conn, &query_no_limit);
|
||||
let limbo_rev = limbo_no_limit.iter().cloned().rev().collect::<Vec<_>>();
|
||||
if limbo_rev == sqlite_no_limit {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
panic!(
|
||||
"limbo: {:?}, sqlite: {:?}, seed: {}, query: {}",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue