Annotation of embedaddon/sqlite3/test/fts2g.test, revision 1.1

1.1     ! misho       1: # 2006 October 19
        !             2: #
        !             3: # The author disclaims copyright to this source code.
        !             4: #
        !             5: #*************************************************************************
        !             6: # This file implements regression tests for SQLite library.  The focus
        !             7: # of this script is testing handling of edge cases for various doclist
        !             8: # merging functions in the FTS2 module query logic.
        !             9: #
        !            10: # $Id: fts2g.test,v 1.3 2007/11/16 00:23:08 shess Exp $
        !            11: #
        !            12: 
        !            13: set testdir [file dirname $argv0]
        !            14: source $testdir/tester.tcl
        !            15: 
        !            16: # If SQLITE_ENABLE_FTS2 is defined, omit this file.
        !            17: ifcapable !fts2 {
        !            18:   finish_test
        !            19:   return
        !            20: }
        !            21: 
        !            22: db eval {
        !            23:   CREATE VIRTUAL TABLE t1 USING fts2(content);
        !            24:   INSERT INTO t1 (rowid, content) VALUES(1, 'this is a test');
        !            25:   INSERT INTO t1 (rowid, content) VALUES(2, 'also a test');
        !            26: }
        !            27: 
        !            28: # No hits at all.  Returns empty doclists from termSelect().
        !            29: do_test fts2g-1.1 {
        !            30:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something'}
        !            31: } {}
        !            32: 
        !            33: # Empty left in docListExceptMerge().
        !            34: do_test fts2g-1.2 {
        !            35:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this something'}
        !            36: } {}
        !            37: 
        !            38: # Empty right in docListExceptMerge().
        !            39: do_test fts2g-1.3 {
        !            40:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this -something'}
        !            41: } {1}
        !            42: 
        !            43: # Empty left in docListPhraseMerge().
        !            44: do_test fts2g-1.4 {
        !            45:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"this something"'}
        !            46: } {}
        !            47: 
        !            48: # Empty right in docListPhraseMerge().
        !            49: do_test fts2g-1.5 {
        !            50:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH '"something is"'}
        !            51: } {}
        !            52: 
        !            53: # Empty left in docListOrMerge().
        !            54: do_test fts2g-1.6 {
        !            55:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something OR this'}
        !            56: } {1}
        !            57: 
        !            58: # Empty right in docListOrMerge().
        !            59: do_test fts2g-1.7 {
        !            60:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this OR something'}
        !            61: } {1}
        !            62: 
        !            63: # Empty left in docListAndMerge().
        !            64: do_test fts2g-1.8 {
        !            65:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something this'}
        !            66: } {}
        !            67: 
        !            68: # Empty right in docListAndMerge().
        !            69: do_test fts2g-1.9 {
        !            70:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this something'}
        !            71: } {}
        !            72: 
        !            73: # No support for all-except queries.
        !            74: do_test fts2g-1.10 {
        !            75:   catchsql {SELECT rowid FROM t1 WHERE t1 MATCH '-this -something'}
        !            76: } {1 {SQL logic error or missing database}}
        !            77: 
        !            78: # Test that docListOrMerge() correctly handles reaching the end of one
        !            79: # doclist before it reaches the end of the other.
        !            80: do_test fts2g-1.11 {
        !            81:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'this OR also'}
        !            82: } {1 2}
        !            83: do_test fts2g-1.12 {
        !            84:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'also OR this'}
        !            85: } {1 2}
        !            86: 
        !            87: # Empty left and right in docListOrMerge().  Each term matches neither
        !            88: # row, and when combined there was an assertion failure.
        !            89: do_test fts2g-1.13 {
        !            90:   execsql {SELECT rowid FROM t1 WHERE t1 MATCH 'something OR nothing'}
        !            91: } {}
        !            92: 
        !            93: finish_test

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>