mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 09:09:19 +08:00
Test series virtual table
This commit is contained in:
parent
b4db5666b6
commit
1d342ef5f3
@ -242,3 +242,33 @@ impl VTabCursor<SeriesTab> for SeriesTabCursor {
|
||||
Ok(self.row_id)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use Connection;
|
||||
use vtab::series;
|
||||
use ffi;
|
||||
|
||||
#[test]
|
||||
fn test_series_module() {
|
||||
let version = unsafe { ffi::sqlite3_libversion_number() };
|
||||
if version < 3008012 {
|
||||
return;
|
||||
}
|
||||
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
series::load_module(&db).unwrap();
|
||||
|
||||
let mut s = db.prepare("SELECT * FROM generate_series(0,20,5)").unwrap();
|
||||
|
||||
|
||||
let series = s.query_map(&[], |row| row.get(0))
|
||||
.unwrap();
|
||||
|
||||
let mut expected = 0;
|
||||
for value in series {
|
||||
assert_eq!(expected, value.unwrap());
|
||||
expected += 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user