add btree fuzz tests which generate seed file from scratch

This commit is contained in:
Nikita Sivukhin
2025-07-06 21:13:32 +04:00
parent f9cd5fad4c
commit 6e2ccdff20
6 changed files with 518 additions and 8 deletions

View File

@@ -0,0 +1,27 @@
use crate::common::TempDatabase;
#[test]
fn test_schema_change() {
let tmp_db = TempDatabase::new_empty(false);
let conn1 = tmp_db.connect_limbo();
conn1.execute("CREATE TABLE t(x, y, z)").unwrap();
conn1
.execute("INSERT INTO t VALUES (1, 2, 3), (10, 20, 30)")
.unwrap();
let conn2 = tmp_db.connect_limbo();
let mut stmt = conn2.prepare("SELECT x, z FROM t").unwrap();
conn1.execute("ALTER TABLE t DROP COLUMN x").unwrap();
let row = loop {
match stmt.step() {
Ok(turso_core::StepResult::Row) => {
let row = stmt.row().unwrap();
break row;
}
Ok(turso_core::StepResult::IO) => {
stmt.run_once().unwrap();
}
_ => panic!("unexpected step result"),
}
};
println!("{:?} {:?}", row.get_value(0), row.get_value(1));
}