11ff94071Sdan# 2019 July 17 21ff94071Sdan# 31ff94071Sdan# The author disclaims copyright to this source code. In place of 41ff94071Sdan# a legal notice, here is a blessing: 51ff94071Sdan# 61ff94071Sdan# May you do good and not evil. 71ff94071Sdan# May you find forgiveness for yourself and forgive others. 81ff94071Sdan# May you share freely, never taking more than you give. 91ff94071Sdan# 101ff94071Sdan#************************************************************************* 111ff94071Sdan# This file implements regression tests for SQLite library. 121ff94071Sdan# 131ff94071Sdan 141ff94071Sdanset testdir [file dirname $argv0] 151ff94071Sdansource $testdir/tester.tcl 161ff94071Sdanset testprefix without_rowid7 171ff94071Sdan 18*b008e4d7Sdanproc do_execsql_test_if_vtab {tn sql {res {}}} { 19*b008e4d7Sdan ifcapable vtab { uplevel [list do_execsql_test $tn $sql $res] } 20*b008e4d7Sdan} 21*b008e4d7Sdan 221ff94071Sdando_execsql_test 1.0 { 231ff94071Sdan CREATE TABLE t1(a, b COLLATE nocase, PRIMARY KEY(a, a, b)) WITHOUT ROWID; 241ff94071Sdan} 251ff94071Sdan 261ff94071Sdando_catchsql_test 1.1 { 271ff94071Sdan INSERT INTO t1 VALUES(1, 'one'), (1, 'ONE'); 281ff94071Sdan} {1 {UNIQUE constraint failed: t1.a, t1.b}} 291ff94071Sdan 301ff94071Sdan 311ff94071Sdando_execsql_test 2.0 { 327b1904e3Sdrh CREATE TABLE t2(a, b, PRIMARY KEY(a COLLATE nocase, a)) WITHOUT ROWID; 331ff94071Sdan} 341ff94071Sdan 351ff94071Sdando_execsql_test 2.1 { 361ff94071Sdan INSERT INTO t2 VALUES(1, 'one'); 371ff94071Sdan SELECT b FROM t2; 381ff94071Sdan} {one} 391ff94071Sdan 407b1904e3Sdrhdo_execsql_test 2.2a { 417b1904e3Sdrh PRAGMA index_info(t2); 427b1904e3Sdrh} {0 0 a 1 0 a} 43*b008e4d7Sdando_execsql_test_if_vtab 2.2b { 447b1904e3Sdrh SELECT *, '|' FROM pragma_index_info('t2'); 457b1904e3Sdrh} {0 0 a | 1 0 a |} 467b1904e3Sdrhdo_execsql_test 2.3a { 477b1904e3Sdrh PRAGMA index_xinfo(t2); 487b1904e3Sdrh} {0 0 a 0 nocase 1 1 0 a 0 BINARY 1 2 1 b 0 BINARY 0} 49*b008e4d7Sdando_execsql_test_if_vtab 2.3b { 507b1904e3Sdrh SELECT *, '|' FROM pragma_index_xinfo('t2'); 517b1904e3Sdrh} {0 0 a 0 nocase 1 | 1 0 a 0 BINARY 1 | 2 1 b 0 BINARY 0 |} 527b1904e3Sdrh 537b1904e3Sdrhdo_execsql_test 2.4 { 547b1904e3Sdrh CREATE TABLE t3(a, b, PRIMARY KEY(a COLLATE nocase, a)); 557b1904e3Sdrh PRAGMA index_info(t3); 567b1904e3Sdrh} {} 577b1904e3Sdrh 587b1904e3Sdrh 591ff94071Sdan 601ff94071Sdanfinish_test 61