Reindex tests added and bugs fixed. (CVS 2075)
FossilOrigin-Name: ad433ec2b6bd34e33dfe119668f38fbb978e889d
This commit is contained in:
+15
-1
@@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the CREATE INDEX statement.
|
||||
#
|
||||
# $Id: index.test,v 1.34 2004/11/04 04:42:28 drh Exp $
|
||||
# $Id: index.test,v 1.35 2004/11/07 13:01:50 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -86,6 +86,13 @@ do_test index-3.1 {
|
||||
WHERE type='index' AND tbl_name='test1'
|
||||
ORDER BY name}
|
||||
} $r
|
||||
integrity_check index-3.2.1
|
||||
ifcapable {reindex} {
|
||||
do_test index-3.2.2 {
|
||||
execsql REINDEX
|
||||
} {}
|
||||
}
|
||||
integrity_check index-3.2.3
|
||||
|
||||
|
||||
# Verify that all the indices go away when we drop the table.
|
||||
@@ -654,6 +661,13 @@ do_test index-19.6 {
|
||||
}
|
||||
} {1 {conflicting ON CONFLICT clauses specified}}
|
||||
|
||||
ifcapable {reindex} {
|
||||
do_test index-19.7 {
|
||||
execsql REINDEX
|
||||
} {}
|
||||
}
|
||||
integrity_check index-19.8
|
||||
|
||||
# Drop index with a quoted name. Ticket #695.
|
||||
#
|
||||
do_test index-20.1 {
|
||||
|
||||
+11
-1
@@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the INSERT statement.
|
||||
#
|
||||
# $Id: insert.test,v 1.19 2004/11/03 16:27:02 drh Exp $
|
||||
# $Id: insert.test,v 1.20 2004/11/07 13:01:50 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -160,6 +160,11 @@ do_test insert-3.3 {
|
||||
do_test insert-3.4 {
|
||||
execsql {SELECT * FROM test2 WHERE f1=22 AND f2=-4.44}
|
||||
} {22 -4.44 hi abc-123 wham}
|
||||
ifcapable {reindex} {
|
||||
do_test insert-3.5 {
|
||||
execsql REINDEX
|
||||
} {}
|
||||
}
|
||||
integrity_check insert-3.5
|
||||
|
||||
# Test of expressions in the VALUES clause
|
||||
@@ -293,6 +298,11 @@ do_test insert-6.4 {
|
||||
SELECT * FROM t1 WHERE b=3;
|
||||
}
|
||||
} {}
|
||||
ifcapable {reindex} {
|
||||
do_test insert-6.7 {
|
||||
execsql REINDEX
|
||||
} {}
|
||||
}
|
||||
|
||||
integrity_check insert-99.0
|
||||
|
||||
|
||||
+79
-1
@@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library.
|
||||
# This file implements tests for the REINDEX command.
|
||||
#
|
||||
# $Id: reindex.test,v 1.1 2004/11/05 23:46:15 drh Exp $
|
||||
# $Id: reindex.test,v 1.2 2004/11/07 13:01:50 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -63,4 +63,82 @@ do_test reindex-1.9 {
|
||||
}
|
||||
} {1 {unable to identify the object to be reindexed}}
|
||||
|
||||
# Set up a table for testing that includes several different collating
|
||||
# sequences including some that we can modify.
|
||||
#
|
||||
do_test reindex-2.1 {
|
||||
proc c1 {a b} {
|
||||
return [expr {-[string compare $a $b]}]
|
||||
}
|
||||
proc c2 {a b} {
|
||||
return [expr {-[string compare [string tolower $a] [string tolower $b]]}]
|
||||
}
|
||||
db collate c1 c1
|
||||
db collate c2 c2
|
||||
execsql {
|
||||
CREATE TABLE t2(
|
||||
a TEXT PRIMARY KEY COLLATE c1,
|
||||
b TEXT UNIQUE COLLATE c2,
|
||||
c TEXT COLLATE nocase,
|
||||
d TEST COLLATE binary
|
||||
);
|
||||
INSERT INTO t2 VALUES('abc','abc','abc','abc');
|
||||
INSERT INTO t2 VALUES('ABCD','ABCD','ABCD','ABCD');
|
||||
INSERT INTO t2 VALUES('bcd','bcd','bcd','bcd');
|
||||
INSERT INTO t2 VALUES('BCDE','BCDE','BCDE','BCDE');
|
||||
SELECT a FROM t2 ORDER BY a;
|
||||
}
|
||||
} {bcd abc BCDE ABCD}
|
||||
do_test reindex-2.2 {
|
||||
execsql {
|
||||
SELECT b FROM t2 ORDER BY b;
|
||||
}
|
||||
} {BCDE bcd ABCD abc}
|
||||
do_test reindex-2.3 {
|
||||
execsql {
|
||||
SELECT c FROM t2 ORDER BY c;
|
||||
}
|
||||
} {abc ABCD bcd BCDE}
|
||||
do_test reindex-2.4 {
|
||||
execsql {
|
||||
SELECT d FROM t2 ORDER BY d;
|
||||
}
|
||||
} {ABCD BCDE abc bcd}
|
||||
|
||||
# Change a collating sequence function. Verify that REINDEX rebuilds
|
||||
# the index.
|
||||
#
|
||||
do_test reindex-2.5 {
|
||||
proc c1 {a b} {
|
||||
return [string compare $a $b]
|
||||
}
|
||||
execsql {
|
||||
SELECT a FROM t2 ORDER BY a;
|
||||
}
|
||||
} {bcd abc BCDE ABCD}
|
||||
ifcapable {integrityck} {
|
||||
do_test reindex-2.5.1 {
|
||||
string equal ok [execsql {PRAGMA integrity_check}]
|
||||
} {0}
|
||||
}
|
||||
do_test reindex-2.6 {
|
||||
execsql {
|
||||
REINDEX c2;
|
||||
SELECT a FROM t2 ORDER BY a;
|
||||
}
|
||||
} {bcd abc BCDE ABCD}
|
||||
do_test reindex-2.7 {
|
||||
execsql {
|
||||
REINDEX t1;
|
||||
SELECT a FROM t2 ORDER BY a;
|
||||
}
|
||||
} {bcd abc BCDE ABCD}
|
||||
do_test reindex-2.8 {
|
||||
execsql {
|
||||
REINDEX c1;
|
||||
SELECT a FROM t2 ORDER BY a;
|
||||
}
|
||||
} {ABCD BCDE abc bcd}
|
||||
integrity_check reindex-2.8.1
|
||||
|
||||
finish_test
|
||||
|
||||
Reference in New Issue
Block a user