Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: third_party/sqlite/sqlite-src-3100200/test/delete4.test

Issue 1610543003: [sql] Import reference version of SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/sqlite/sqlite-src-3100200/test/delete4.test
diff --git a/third_party/sqlite/sqlite-src-3100200/test/delete4.test b/third_party/sqlite/sqlite-src-3100200/test/delete4.test
new file mode 100644
index 0000000000000000000000000000000000000000..f3598a9496bd8a4a972453c03219b4f4539619e8
--- /dev/null
+++ b/third_party/sqlite/sqlite-src-3100200/test/delete4.test
@@ -0,0 +1,145 @@
+# 2005 August 24
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this script is a test of the DELETE command.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix delete4
+
+do_execsql_test 1.1 {
+ CREATE TABLE t1(x INTEGER PRIMARY KEY, y);
+ INSERT INTO t1 VALUES(1, 0);
+ INSERT INTO t1 VALUES(2, 1);
+ INSERT INTO t1 VALUES(3, 0);
+ INSERT INTO t1 VALUES(4, 1);
+ INSERT INTO t1 VALUES(5, 0);
+ INSERT INTO t1 VALUES(6, 1);
+ INSERT INTO t1 VALUES(7, 0);
+ INSERT INTO t1 VALUES(8, 1);
+}
+do_execsql_test 1.2 {
+ DELETE FROM t1 WHERE y=1;
+}
+do_execsql_test 1.3 {
+ SELECT x FROM t1;
+} {1 3 5 7}
+
+#-------------------------------------------------------------------------
+#
+reset_db
+do_execsql_test 2.1 {
+ CREATE TABLE t1(x INTEGER PRIMARY KEY, y, z);
+ INSERT INTO t1 VALUES(1, 0, randomblob(200));
+ INSERT INTO t1 VALUES(2, 1, randomblob(200));
+ INSERT INTO t1 VALUES(3, 0, randomblob(200));
+ INSERT INTO t1 VALUES(4, 1, randomblob(200));
+ INSERT INTO t1 VALUES(5, 0, randomblob(200));
+ INSERT INTO t1 VALUES(6, 1, randomblob(200));
+ INSERT INTO t1 VALUES(7, 0, randomblob(200));
+ INSERT INTO t1 VALUES(8, 1, randomblob(200));
+}
+do_execsql_test 2.2 {
+ DELETE FROM t1 WHERE y=1;
+}
+do_execsql_test 2.3 {
+ SELECT x FROM t1;
+} {1 3 5 7}
+
+
+#-------------------------------------------------------------------------
+#
+reset_db
+do_execsql_test 3.1 {
+ CREATE TABLE t1(a, b, PRIMARY KEY(a, b)) WITHOUT ROWID;
+ INSERT INTO t1 VALUES(1, 2);
+ INSERT INTO t1 VALUES(2, 4);
+ INSERT INTO t1 VALUES(1, 5);
+ DELETE FROM t1 WHERE a=1;
+ SELECT * FROM t1;
+} {2 4}
+
+#-------------------------------------------------------------------------
+# DELETE statement that uses the OR optimization
+#
+reset_db
+do_execsql_test 3.1 {
+ CREATE TABLE t1(i INTEGER PRIMARY KEY, a, b);
+ CREATE INDEX i1a ON t1(a);
+ CREATE INDEX i1b ON t1(b);
+ INSERT INTO t1 VALUES(1, 'one', 'i');
+ INSERT INTO t1 VALUES(2, 'two', 'ii');
+ INSERT INTO t1 VALUES(3, 'three', 'iii');
+ INSERT INTO t1 VALUES(4, 'four', 'iv');
+ INSERT INTO t1 VALUES(5, 'one', 'i');
+ INSERT INTO t1 VALUES(6, 'two', 'ii');
+ INSERT INTO t1 VALUES(7, 'three', 'iii');
+ INSERT INTO t1 VALUES(8, 'four', 'iv');
+} {}
+
+do_execsql_test 3.2 {
+ DELETE FROM t1 WHERE a='two' OR b='iv';
+}
+
+do_execsql_test 3.3 {
+ SELECT i FROM t1 ORDER BY i;
+} {1 3 5 7}
+
+do_execsql_test 3.4 {
+ PRAGMA integrity_check;
+} {ok}
+
+# Between 2015-09-14 and 2015-09-28, the following test cases would result
+# in corruption (wrong # of entries in index) due to a bug in the ONEPASS
+# optimization.
+#
+do_execsql_test 4.1 {
+ DROP TABLE IF EXISTS t4;
+ CREATE TABLE t4(col0, col1);
+ INSERT INTO "t4" VALUES(14, 'abcde');
+ CREATE INDEX idx_t4_0 ON t4 (col1, col0);
+ CREATE INDEX idx_t4_3 ON t4 (col0);
+ DELETE FROM t4 WHERE col0=69 OR col0>7;
+ PRAGMA integrity_check;
+} {ok}
+do_execsql_test 4.2 {
+ DROP TABLE IF EXISTS t4;
+ CREATE TABLE t4(col0, col1);
+ INSERT INTO "t4" VALUES(14, 'abcde');
+ CREATE INDEX idx_t4_3 ON t4 (col0);
+ CREATE INDEX idx_t4_0 ON t4 (col1, col0);
+ DELETE FROM t4 WHERE col0=69 OR col0>7;
+ PRAGMA integrity_check;
+} {ok}
+do_execsql_test 4.11 {
+ DROP TABLE IF EXISTS t4;
+ CREATE TABLE t4(col0, col1, pk PRIMARY KEY) WITHOUT ROWID;
+ INSERT INTO t4 VALUES(14, 'abcde','xyzzy');
+ CREATE INDEX idx_t4_0 ON t4 (col1, col0);
+ CREATE INDEX idx_t4_3 ON t4 (col0);
+ DELETE FROM t4 WHERE col0=69 OR col0>7;
+ PRAGMA integrity_check;
+} {ok}
+do_execsql_test 4.12 {
+ DROP TABLE IF EXISTS t4;
+ CREATE TABLE t4(col0, col1, pk PRIMARY KEY) WITHOUT ROWID;
+ INSERT INTO t4 VALUES(14, 'abcde','xyzzy');
+ CREATE INDEX idx_t4_3 ON t4 (col0);
+ CREATE INDEX idx_t4_0 ON t4 (col1, col0);
+ DELETE FROM t4 WHERE col0=69 OR col0>7;
+ PRAGMA integrity_check;
+} {ok}
+
+
+
+
+finish_test
« no previous file with comments | « third_party/sqlite/sqlite-src-3100200/test/delete3.test ('k') | third_party/sqlite/sqlite-src-3100200/test/descidx1.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698