modernc.org/cc@v1.0.1/v2/testdata/_sqlite/ext/fts5/test/fts5delete.test (about) 1 # 2017 May 12 2 # 3 # The author disclaims copyright to this source code. In place of 4 # a legal notice, here is a blessing: 5 # 6 # May you do good and not evil. 7 # May you find forgiveness for yourself and forgive others. 8 # May you share freely, never taking more than you give. 9 # 10 #************************************************************************* 11 # This file implements regression tests for SQLite library. The 12 # focus of this script is testing the FTS5 module. 13 # 14 15 source [file join [file dirname [info script]] fts5_common.tcl] 16 set testprefix fts5delete 17 18 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. 19 ifcapable !fts5 { 20 finish_test 21 return 22 } 23 fts5_aux_test_functions db 24 25 do_execsql_test 1.0 { 26 CREATE VIRTUAL TABLE t1 USING fts5(x); 27 WITH s(i) AS ( 28 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<5000 29 ) 30 INSERT INTO t1(rowid, x) SELECT i, (i/2)*2 FROM s; 31 } 32 33 do_test 1.1 { 34 execsql BEGIN 35 for {set i 1} {$i<=5000} {incr i} { 36 if {$i % 2} { 37 execsql { INSERT INTO t1 VALUES($i) } 38 } else { 39 execsql { DELETE FROM t1 WHERE rowid = $i } 40 } 41 } 42 execsql COMMIT 43 } {} 44 45 do_test 1.2 { 46 execsql { INSERT INTO t1(t1, rank) VALUES('usermerge', 2); } 47 for {set i 0} {$i < 5} {incr i} { 48 execsql { INSERT INTO t1(t1, rank) VALUES('merge', 1) } 49 execsql { INSERT INTO t1(t1) VALUES('integrity-check') } 50 } 51 } {} 52 53 finish_test