Snapshot of upstream SQLite 3.42.0
[sqlcipher.git] / ext / fts5 / test / fts5secure6.test
blobe561a43f7da08d6946c41c1fc499ab63542a0c51
1 # 2023 Feb 17
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
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.
10 #*************************************************************************
13 source [file join [file dirname [info script]] fts5_common.tcl]
14 ifcapable !fts5 { finish_test ; return }
15 set ::testprefix fts5secure6
17 db progress 1 progress_handler
18 set ::PHC 0
19 proc progress_handler {args} {
20   incr ::PHC
21   if {($::PHC % 100000)==0}  breakpoint
22   return 0
25 proc setup {} {
26   db eval {
27     DROP TABLE IF EXISTS t1;
28     CREATE VIRTUAL TABLE t1 USING fts5(x);
29     WITH s(i) AS (
30       VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1000
31     )
32     INSERT INTO t1 SELECT 'a b c d e f g h i j k' FROM s;
33   }
36 foreach {tn sd} {
37   1 0 
38   2 1
39 } {
40   setup
41   do_execsql_test 1.$tn.0 { 
42     INSERT INTO t1(t1, rank) VALUES('secure-delete', $sd) 
43   }
44   set PHC 0
45   do_execsql_test 1.$tn.1 { DELETE FROM t1; }
46   set phc($tn) $PHC
49 do_test 1.3 {
50   expr $phc(1)*5 < $phc(2)
51 } {1}
54 finish_test