diff --git a/testing/all.test b/testing/all.test index 11a885f37..5957f8bcf 100755 --- a/testing/all.test +++ b/testing/all.test @@ -11,7 +11,9 @@ proc evaluate_sql {sqlite_exec sql} { proc run_test {sqlite_exec sql expected_output} { set actual_output [evaluate_sql $sqlite_exec $sql] if {$actual_output ne $expected_output} { - puts "Test FAILED: '$sql' returned '$actual_output'" + puts "Test FAILED: '$sql'" + puts "returned '$actual_output'" + puts "expected '$expected_output'" exit 1 } } @@ -33,11 +35,11 @@ do_execsql_test select-const-2 { do_execsql_test select-avg { SELECT avg(age) FROM users; -} {50.4649} +} {50.396} do_execsql_test select-sum { SELECT sum(age) FROM users; -} {504649} +} {503960} do_execsql_test select-limit { SELECT id FROM users LIMIT 1; @@ -62,3 +64,8 @@ do_execsql_test select-limit-0 { do_execsql_test pragma-cache-size { PRAGMA cache_size } {-2000} + + +do_execsql_test cross-join { + select * from users, products limit 1; +} {1|Jamie|Foster|dylan00@example.com|496-522-9493|62375\ Johnson\ Rest\ Suite\ 322|West\ Lauriestad|IL|35865|94|1|hat|79} diff --git a/testing/gen-database.py b/testing/gen-database.py index b9b8d6908..47108dfd2 100755 --- a/testing/gen-database.py +++ b/testing/gen-database.py @@ -22,6 +22,17 @@ cursor.execute(''' ) ''') +cursor.execute(''' + CREATE TABLE IF NOT EXISTS products ( + id INTEGER PRIMARY KEY, + name TEXT, + price REAL + ) +''') + +product_list = ["hat", "cap", "shirt", "sweater", "sweatshirt", + "shorts", "jeans", "sneakers", "boots", "coat", "accessories"] + fake = Faker() for _ in range(10000): first_name = fake.first_name() @@ -39,6 +50,13 @@ for _ in range(10000): VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ''', (first_name, last_name, email, phone_number, address, city, state, zipcode, age)) +for product in product_list: + price = fake.random_int(min=1, max=100) + cursor.execute(''' + INSERT INTO products (name, price) + VALUES (?, ?) + ''', (product, price)) + conn.commit() diff --git a/testing/testing.db b/testing/testing.db index 9f56c7368..c97eac5ff 100644 Binary files a/testing/testing.db and b/testing/testing.db differ