| OLD | NEW |
| 1 # 2015 Jan 13 | 1 # 2015 Jan 13 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 138 } |
| 139 | 139 |
| 140 do_execsql_test 5.1 { | 140 do_execsql_test 5.1 { |
| 141 INSERT INTO gg(gg) VALUES('integrity-check'); | 141 INSERT INTO gg(gg) VALUES('integrity-check'); |
| 142 } | 142 } |
| 143 | 143 |
| 144 do_execsql_test 5.2 { | 144 do_execsql_test 5.2 { |
| 145 INSERT INTO gg(gg) VALUES('optimize'); | 145 INSERT INTO gg(gg) VALUES('optimize'); |
| 146 } | 146 } |
| 147 | 147 |
| 148 breakpoint | |
| 149 do_execsql_test 5.3 { | 148 do_execsql_test 5.3 { |
| 150 INSERT INTO gg(gg) VALUES('integrity-check'); | 149 INSERT INTO gg(gg) VALUES('integrity-check'); |
| 151 } | 150 } |
| 152 | 151 |
| 152 do_test 5.4.1 { |
| 153 set ok 0 |
| 154 for {set i 0} {$i < 10000} {incr i} { |
| 155 set T [format %.5d $i] |
| 156 set res [db eval { SELECT rowid FROM gg($T) ORDER BY rowid ASC }] |
| 157 set res2 [db eval { SELECT rowid FROM gg($T) ORDER BY rowid DESC }] |
| 158 if {$res == [lsort -integer $res2]} { incr ok } |
| 159 } |
| 160 set ok |
| 161 } {10000} |
| 162 |
| 163 do_test 5.4.2 { |
| 164 set ok 0 |
| 165 for {set i 0} {$i < 100} {incr i} { |
| 166 set T "[format %.3d $i]*" |
| 167 set res [db eval { SELECT rowid FROM gg($T) ORDER BY rowid ASC }] |
| 168 set res2 [db eval { SELECT rowid FROM gg($T) ORDER BY rowid DESC }] |
| 169 if {$res == [lsort -integer $res2]} { incr ok } |
| 170 } |
| 171 set ok |
| 172 } {100} |
| 173 |
| 174 #------------------------------------------------------------------------- |
| 175 # Similar to 5.*. |
| 176 # |
| 177 foreach {tn pgsz} { |
| 178 1 32 |
| 179 2 36 |
| 180 3 40 |
| 181 4 44 |
| 182 5 48 |
| 183 } { |
| 184 do_execsql_test 6.$tn.1 { |
| 185 DROP TABLE IF EXISTS hh; |
| 186 CREATE VIRTUAL TABLE hh USING fts5(y); |
| 187 INSERT INTO hh(hh, rank) VALUES('pgsz', $pgsz); |
| 188 |
| 189 WITH s(i) AS (SELECT 0 UNION ALL SELECT i+1 FROM s WHERE i<999) |
| 190 INSERT INTO hh SELECT printf("%.3d%.3d%.3d %.3d%.3d%.3d",i,i,i,i+1,i+1,i+1) |
| 191 FROM s; |
| 192 |
| 193 WITH s(i) AS (SELECT 0 UNION ALL SELECT i+1 FROM s WHERE i<999) |
| 194 INSERT INTO hh SELECT printf("%.3d%.3d%.3d %.3d%.3d%.3d",i,i,i,i+1,i+1,i+1) |
| 195 FROM s; |
| 196 |
| 197 INSERT INTO hh(hh) VALUES('optimize'); |
| 198 } |
| 199 |
| 200 do_test 6.$tn.2 { |
| 201 set ok 0 |
| 202 for {set i 0} {$i < 1000} {incr i} { |
| 203 set T [format %.3d%.3d%.3d $i $i $i] |
| 204 set res [db eval { SELECT rowid FROM hh($T) ORDER BY rowid ASC }] |
| 205 set res2 [db eval { SELECT rowid FROM hh($T) ORDER BY rowid DESC }] |
| 206 if {$res == [lsort -integer $res2]} { incr ok } |
| 207 } |
| 208 set ok |
| 209 } {1000} |
| 210 } |
| 211 |
| 153 finish_test | 212 finish_test |
| 154 | 213 |
| OLD | NEW |