Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add tests for the new MATCH operator. (CVS 3238) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b4024c394d25e5a0abdb07be779ae415 |
User & Date: | danielk1977 2006-06-14 08:48:26.000 |
Context
2006-06-14
| ||
10:38 | Add some tests for sqlite3_load_extension(). (CVS 3239) (check-in: 402a77c43d user: danielk1977 tags: trunk) | |
08:48 | Add tests for the new MATCH operator. (CVS 3238) (check-in: b4024c394d user: danielk1977 tags: trunk) | |
07:41 | Add a test case for ORDER BY using the echo module. (CVS 3237) (check-in: f459f034f6 user: danielk1977 tags: trunk) | |
Changes
Changes to test/like.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the LIKE and GLOB operators and # in particular the optimizations that occur to help those operators # run faster. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the LIKE and GLOB operators and # in particular the optimizations that occur to help those operators # run faster. # # $Id: like.test,v 1.5 2006/06/14 08:48:26 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create some sample data to work with. # do_test like-1.0 { |
︙ | ︙ | |||
109 110 111 112 113 114 115 116 117 118 119 120 121 122 | } } {{ABC abc xyz} abc abcd} do_test like-2.2 { execsql { SELECT x FROM t1 WHERE x REGEXP '^abc' ORDER BY 1; } } {abc abcd} # For the remaining tests, we need to have the like optimizations # enabled. # ifcapable !like_opt { finish_test return | > > > > > > > > > > > > > > > > > | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | } } {{ABC abc xyz} abc abcd} do_test like-2.2 { execsql { SELECT x FROM t1 WHERE x REGEXP '^abc' ORDER BY 1; } } {abc abcd} # Tests of the MATCH operator # do_test like-2.3 { proc test_match {a b} { return [string match $a $b] } db function match test_match execsql { SELECT x FROM t1 WHERE x MATCH '*abc*' ORDER BY 1; } } {{ABC abc xyz} abc abcd} do_test like-2.4 { execsql { SELECT x FROM t1 WHERE x MATCH 'abc*' ORDER BY 1; } } {abc abcd} # For the remaining tests, we need to have the like optimizations # enabled. # ifcapable !like_opt { finish_test return |
︙ | ︙ |
Changes to test/vtab1.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2006 June 10 # # 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 file is creating and dropping virtual tables. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2006 June 10 # # 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 file is creating and dropping virtual tables. # # $Id: vtab1.test,v 1.14 2006/06/14 08:48:26 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !vtab { finish_test return |
︙ | ︙ | |||
317 318 319 320 321 322 323 324 325 326 327 328 329 330 | } } {1 2 3 4 5 6} do_test vtab1-3.13 { set echo_module } [list xBestIndex {SELECT rowid, * FROM 'treal' WHERE b >= ? AND b <= ?} \ xFilter {SELECT rowid, * FROM 'treal' WHERE b >= ? AND b <= ?} 2 10 ] #---------------------------------------------------------------------- # Test case vtab1-3 test table scans and the echo module's # xBestIndex/xFilter handling of ORDER BY clauses. # This procedure executes the SQL. Then it checks to see if the OP_Sort # opcode was executed. If an OP_Sort did occur, then "sort" is appended # to the result. If no OP_Sort happened, then "nosort" is appended. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | } } {1 2 3 4 5 6} do_test vtab1-3.13 { set echo_module } [list xBestIndex {SELECT rowid, * FROM 'treal' WHERE b >= ? AND b <= ?} \ xFilter {SELECT rowid, * FROM 'treal' WHERE b >= ? AND b <= ?} 2 10 ] # Add a function for the MATCH operator. Everything always matches! proc test_match {lhs rhs} { lappend ::echo_module MATCH $lhs $rhs return 1 } db function match test_match set echo_module "" do_test vtab1-3.12 { set echo_module "" execsql { SELECT * FROM t1 WHERE a MATCH 'string'; } } {1 2 3 4 5 6} do_test vtab1-3.13 { set echo_module } [list xBestIndex {SELECT rowid, * FROM 'treal'} \ xFilter {SELECT rowid, * FROM 'treal'} \ MATCH string 1 \ MATCH string 4 \ ] do_test vtab1-3.14 { set echo_module "" execsql { SELECT * FROM t1 WHERE b MATCH 'string'; } } {1 2 3 4 5 6} do_test vtab1-3.15 { set echo_module } [list xBestIndex {SELECT rowid, * FROM 'treal' WHERE b MATCH ?} \ xFilter {SELECT rowid, * FROM 'treal' WHERE b MATCH ?} string ] #---------------------------------------------------------------------- # Test case vtab1-3 test table scans and the echo module's # xBestIndex/xFilter handling of ORDER BY clauses. # This procedure executes the SQL. Then it checks to see if the OP_Sort # opcode was executed. If an OP_Sort did occur, then "sort" is appended # to the result. If no OP_Sort happened, then "nosort" is appended. |
︙ | ︙ |