Adds a few more NULL generate_series tests

This commit is contained in:
David Selassie 2023-07-07 09:17:30 -07:00
parent 3a2312e0bd
commit 3c5a9be349

View File

@ -328,13 +328,23 @@ mod test {
let mut s = db.prepare("SELECT * FROM generate_series(NULL)")?;
let series: Vec<i32> = s.query([])?.map(|r| r.get(0)).collect()?;
assert_eq!(Vec::<i32>::new(), series);
let empty = Vec::<i32>::new();
assert_eq!(empty, series);
let mut s = db.prepare("SELECT * FROM generate_series(5,NULL)")?;
let series: Vec<i32> = s.query([])?.map(|r| r.get(0)).collect()?;
assert_eq!(Vec::<i32>::new(), series);
assert_eq!(empty, series);
let mut s = db.prepare("SELECT * FROM generate_series(5,10,NULL)")?;
let series: Vec<i32> = s.query([])?.map(|r| r.get(0)).collect()?;
assert_eq!(Vec::<i32>::new(), series);
assert_eq!(empty, series);
let mut s = db.prepare("SELECT * FROM generate_series(NULL,10,2)")?;
let series: Vec<i32> = s.query([])?.map(|r| r.get(0)).collect()?;
assert_eq!(empty, series);
let mut s = db.prepare("SELECT * FROM generate_series(5,NULL,2)")?;
let series: Vec<i32> = s.query([])?.map(|r| r.get(0)).collect()?;
assert_eq!(empty, series);
let mut s = db.prepare("SELECT * FROM generate_series(NULL) ORDER BY value DESC")?;
let series: Vec<i32> = s.query([])?.map(|r| r.get(0)).collect()?;
assert_eq!(empty, series);
Ok(())
}