/ Check-in [02174842]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add new test file fts5vocab2.test.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 02174842c353bfaa747019cb3dcdee5bca6551d0a06d83fc1ac6d4569e16bc34
User & Date: dan 2017-08-12 18:31:31
Context
2017-08-14
01:33
Properly dequote column names in tables constructed by an aggregate SELECT. check-in: 7e0d3e9c user: drh tags: trunk
2017-08-12
18:31
Add new test file fts5vocab2.test. check-in: 02174842 user: dan tags: trunk
02:16
Update the speed-check.sh test script to append log output to the end of the cout-NAME.txt file. check-in: 14d262d6 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added ext/fts5/test/fts5vocab2.test.

            1  +# 2017 August 10
            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  +#
           12  +# The tests in this file focus on testing the fts5vocab module.
           13  +#
           14  +
           15  +source [file join [file dirname [info script]] fts5_common.tcl]
           16  +set testprefix fts5vocab
           17  +
           18  +# If SQLITE_ENABLE_FTS5 is defined, omit this file.
           19  +ifcapable !fts5 {
           20  +  finish_test
           21  +  return
           22  +}
           23  +
           24  +do_execsql_test 1.0 {
           25  +  CREATE VIRTUAL TABLE t1 USING fts5(a, b);
           26  +  CREATE VIRTUAL TABLE v1 USING fts5vocab(t1, instance);
           27  +
           28  +  INSERT INTO t1 VALUES('one two', 'two three');
           29  +  INSERT INTO t1 VALUES('three four', 'four five five five');
           30  +}
           31  +
           32  +do_execsql_test 1.1 {
           33  +  SELECT * FROM v1;
           34  +} {
           35  +  five  2 b 1
           36  +  five  2 b 2
           37  +  five  2 b 3
           38  +  four  2 a 1
           39  +  four  2 b 0
           40  +  one   1 a 0
           41  +  three 1 b 1
           42  +  three 2 a 0
           43  +  two   1 a 1
           44  +  two   1 b 0
           45  +}
           46  +
           47  +do_execsql_test 1.2 {
           48  +  SELECT * FROM v1 WHERE term='three';
           49  +} {
           50  +  three 1 b 1
           51  +  three 2 a 0
           52  +}
           53  +
           54  +do_execsql_test 1.3 {
           55  +  BEGIN;
           56  +    DELETE FROM t1 WHERE rowid=2;
           57  +    SELECT * FROM v1;
           58  +  ROLLBACK;
           59  +} {
           60  +  one   1 a 0
           61  +  three 1 b 1
           62  +  two   1 a 1
           63  +  two   1 b 0
           64  +}
           65  +
           66  +do_execsql_test 1.4 {
           67  +  BEGIN;
           68  +    DELETE FROM t1 WHERE rowid=1;
           69  +    SELECT * FROM v1;
           70  +  ROLLBACK;
           71  +} {
           72  +  five  2 b 1
           73  +  five  2 b 2
           74  +  five  2 b 3
           75  +  four  2 a 1
           76  +  four  2 b 0
           77  +  three 2 a 0
           78  +}
           79  +
           80  +do_execsql_test 1.5 {
           81  +  DELETE FROM t1;
           82  +  SELECT * FROM v1;
           83  +} {
           84  +}
           85  +
           86  +#-------------------------------------------------------------------------
           87  +#
           88  +do_execsql_test 2.0 {
           89  +  DROP TABLE IF EXISTS t1;
           90  +  DROP TABLE IF EXISTS v1;
           91  +
           92  +  CREATE VIRTUAL TABLE t1 USING fts5(a, b, detail=column);
           93  +  CREATE VIRTUAL TABLE v1 USING fts5vocab(t1, instance);
           94  +
           95  +  INSERT INTO t1 VALUES('one two', 'two three');
           96  +  INSERT INTO t1 VALUES('three four', 'four five five five');
           97  +}
           98  +
           99  +do_execsql_test 2.1 {
          100  +  SELECT * FROM v1;
          101  +} {
          102  +  five  2 b {}
          103  +  four  2 a {}
          104  +  four  2 b {}
          105  +  one   1 a {}
          106  +  three 1 b {}
          107  +  three 2 a {}
          108  +  two   1 a {}
          109  +  two   1 b {}
          110  +}
          111  +
          112  +do_execsql_test 2.2 {
          113  +  SELECT * FROM v1 WHERE term='three';
          114  +} {
          115  +  three 1 b {}
          116  +  three 2 a {}
          117  +}
          118  +
          119  +do_execsql_test 2.3 {
          120  +  BEGIN;
          121  +    DELETE FROM t1 WHERE rowid=2;
          122  +    SELECT * FROM v1;
          123  +  ROLLBACK;
          124  +} {
          125  +  one   1 a {}
          126  +  three 1 b {}
          127  +  two   1 a {}
          128  +  two   1 b {}
          129  +}
          130  +
          131  +do_execsql_test 2.4 {
          132  +  BEGIN;
          133  +    DELETE FROM t1 WHERE rowid=1;
          134  +    SELECT * FROM v1;
          135  +  ROLLBACK;
          136  +} {
          137  +  five  2 b {}
          138  +  four  2 a {}
          139  +  four  2 b {}
          140  +  three 2 a {}
          141  +}
          142  +
          143  +do_execsql_test 2.5 {
          144  +  DELETE FROM t1;
          145  +  SELECT * FROM v1;
          146  +} {
          147  +}
          148  +
          149  +#-------------------------------------------------------------------------
          150  +#
          151  +do_execsql_test 3.0 {
          152  +  DROP TABLE IF EXISTS t1;
          153  +  DROP TABLE IF EXISTS v1;
          154  +
          155  +  CREATE VIRTUAL TABLE t1 USING fts5(a, b, detail=none);
          156  +  CREATE VIRTUAL TABLE v1 USING fts5vocab(t1, instance);
          157  +
          158  +  INSERT INTO t1 VALUES('one two', 'two three');
          159  +  INSERT INTO t1 VALUES('three four', 'four five five five');
          160  +}
          161  +
          162  +do_execsql_test 3.1 {
          163  +  SELECT * FROM v1;
          164  +} {
          165  +  five  2 {} {}
          166  +  four  2 {} {}
          167  +  one   1 {} {}
          168  +  three 1 {} {}
          169  +  three 2 {} {}
          170  +  two   1 {} {}
          171  +}
          172  +
          173  +do_execsql_test 3.2 {
          174  +  SELECT * FROM v1 WHERE term='three';
          175  +} {
          176  +  three 1 {} {}
          177  +  three 2 {} {}
          178  +}
          179  +
          180  +do_execsql_test 3.3 {
          181  +  BEGIN;
          182  +    DELETE FROM t1 WHERE rowid=2;
          183  +    SELECT * FROM v1;
          184  +  ROLLBACK;
          185  +} {
          186  +  one   1 {} {}
          187  +  three 1 {} {}
          188  +  two   1 {} {}
          189  +}
          190  +
          191  +do_execsql_test 3.4 {
          192  +  BEGIN;
          193  +    DELETE FROM t1 WHERE rowid=1;
          194  +    SELECT * FROM v1;
          195  +  ROLLBACK;
          196  +} {
          197  +  five  2 {} {}
          198  +  four  2 {} {}
          199  +  three 2 {} {}
          200  +}
          201  +
          202  +do_execsql_test 3.5 {
          203  +  DELETE FROM t1;
          204  +  SELECT * FROM v1;
          205  +} {
          206  +}
          207  +
          208  +finish_test
          209  +