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

1.1     ! misho       1: # 2006 October 1
        !             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 FTS2 module, and in particular
        !            13: # the Porter stemmer.
        !            14: #
        !            15: # $Id: fts2d.test,v 1.1 2006/10/19 23:36:26 shess Exp $
        !            16: #
        !            17: 
        !            18: set testdir [file dirname $argv0]
        !            19: source $testdir/tester.tcl
        !            20: 
        !            21: # If SQLITE_ENABLE_FTS2 is defined, omit this file.
        !            22: ifcapable !fts2 {
        !            23:   finish_test
        !            24:   return
        !            25: }
        !            26: 
        !            27: do_test fts2d-1.1 {
        !            28:   execsql {
        !            29:     CREATE VIRTUAL TABLE t1 USING fts2(content, tokenize porter);
        !            30:     INSERT INTO t1(rowid, content) VALUES(1, 'running and jumping');
        !            31:     SELECT rowid FROM t1 WHERE content MATCH 'run jump';
        !            32:   }
        !            33: } {1}
        !            34: do_test fts2d-1.2 {
        !            35:   execsql {
        !            36:     SELECT snippet(t1) FROM t1 WHERE t1 MATCH 'run jump';
        !            37:   }
        !            38: } {{<b>running</b> and <b>jumping</b>}}
        !            39: do_test fts2d-1.3 {
        !            40:   execsql {
        !            41:     INSERT INTO t1(rowid, content) 
        !            42:           VALUES(2, 'abcdefghijklmnopqrstuvwyxz');
        !            43:     SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijqrstuvwyxz'
        !            44:   }
        !            45: } {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
        !            46: do_test fts2d-1.4 {
        !            47:   execsql {
        !            48:     SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH 'abcdefghijXXXXqrstuvwyxz'
        !            49:   }
        !            50: } {2 <b>abcdefghijklmnopqrstuvwyxz</b>}
        !            51: do_test fts2d-1.5 {
        !            52:   execsql {
        !            53:     INSERT INTO t1(rowid, content) 
        !            54:           VALUES(3, 'The value is 123456789');
        !            55:     SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123789'
        !            56:   }
        !            57: } {3 {The value is <b>123456789</b>}}
        !            58: do_test fts2d-1.6 {
        !            59:   execsql {
        !            60:     SELECT rowid, snippet(t1) FROM t1 WHERE t1 MATCH '123000000789'
        !            61:   }
        !            62: } {3 {The value is <b>123456789</b>}}
        !            63: 
        !            64: 
        !            65: finish_test

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