/ Check-in [e5336edc]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Add a test to e_fts3.test for the matchinfo example in fts3.html.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e5336edc55313afac11ea085257cb6e75a0287a7
User & Date: dan 2010-01-14 11:45:04
Context
2010-01-15
17:25
Add coverage tests for fts3_snippet.c. Also fixes related to the same. check-in: 5e9d8cca user: dan tags: trunk
2010-01-14
11:45
Add a test to e_fts3.test for the matchinfo example in fts3.html. check-in: e5336edc user: dan tags: trunk
11:17
Fix some matchinfo related test problems in fts3rnd.test. check-in: da7abe05 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/e_fts3.test.

    60     60   # [foreach] loop is testing with OOM errors, disable the lookaside buffer.
    61     61   #
    62     62   db close
    63     63   file delete -force test.db test.db-journal
    64     64   sqlite3 db test.db
    65     65   if {$DO_MALLOC_TEST} { sqlite3_db_config_lookaside db 0 0 0 }
    66     66   db eval "PRAGMA encoding = '$enc'"
           67  +
           68  +proc mit {blob} {
           69  +  set scan(littleEndian) i*
           70  +  set scan(bigEndian) I*
           71  +  binary scan $blob $scan($::tcl_platform(byteOrder)) r
           72  +  return $r
           73  +}
           74  +db func mit mit
    67     75   
    68     76   ##########################################################################
    69     77   # Test the example CREATE VIRTUAL TABLE statements in section 1.1 
    70     78   # of fts3.in.
    71     79   #
    72     80   ddl_test   1.1.1.1 {CREATE VIRTUAL TABLE data USING fts3()}
    73     81   read_test  1.1.1.2 {PRAGMA table_info(data)} {0 content {} 0 {} 0}
................................................................................
   420    428   read_test  1.7.2.3 {
   421    429     SELECT snippet(text) FROM text WHERE text MATCH 'cold'
   422    430   } {{<b>...</b>cool elsewhere, minimum temperature 17-20oC. <b>Cold</b> to very <b>cold</b> on mountaintops, minimum temperature 6<b>...</b>}}
   423    431   
   424    432   read_test  1.7.2.4 {
   425    433     SELECT snippet(text, '[', ']', '...') FROM text WHERE text MATCH '"min* tem*"'
   426    434   } {{...the upper portion, [minimum] [temperature] 14-16oC and cool elsewhere, [minimum] [temperature] 17-20oC. Cold...}}
          435  +
          436  +ddl_test   1.7.3.1 { DROP TABLE IF EXISTS t1 }
          437  +ddl_test   1.7.3.2 { CREATE VIRTUAL TABLE t1 USING fts3(a, b) }
          438  +write_test 1.7.3.3 t1_content { 
          439  +  INSERT INTO t1 VALUES(
          440  +    'transaction default models default', 'Non transaction reads');
          441  +}
          442  +write_test 1.7.3.4 t1_content { 
          443  +  INSERT INTO t1 VALUES('the default transaction', 'these semantics present');
          444  +}
          445  +write_test 1.7.3.5 t1_content { 
          446  +  INSERT INTO t1 VALUES('single request', 'default data');
          447  +}
          448  +read_test  1.7.3.6 { 
          449  +  SELECT mit(matchinfo(t1)) FROM t1 
          450  +    WHERE t1 MATCH 'default transaction "these semantics"';
          451  +} {{3 2 1 3 2 0 1 1 1 2 2 0 1 1 0 0 0 1 1 1}}
   427    452   
   428    453   ##########################################################################
   429    454   # Test the example in section 5 (custom tokenizers).
   430    455   #
   431    456   ddl_test   1.8.1.1 { CREATE VIRTUAL TABLE simple USING fts3(tokenize=simple) } 
   432    457   write_test 1.8.1.2 simple_content { 
   433    458     INSERT INTO simple VALUES('Right now they''re very frustrated')
................................................................................
   448    473   #-------------------------------------------------------------------------
   449    474   
   450    475   #-------------------------------------------------------------------------
   451    476   # Test that errors in the arguments passed to the snippet and offsets
   452    477   # functions are handled correctly.
   453    478   #
   454    479   set DO_MALLOC_TEST 0
          480  +ddl_test   2.1.0 { DROP TABLE IF EXISTS t1 }
   455    481   ddl_test   2.1.1 { CREATE VIRTUAL TABLE t1 USING fts3(a, b) }
   456    482   write_test 2.1.2 t1_content { 
   457    483     INSERT INTO t1 VALUES('one two three', x'A1B2C3D4E5F6');
   458    484   }
   459    485   error_test 2.1.3 {
   460    486     SELECT offsets(a) FROM t1 WHERE a MATCH 'one'
   461    487   } {illegal first argument to offsets}