Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add tests for the remaining examples in fts3.in. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e381cd5229b30168769330cb201bae26 |
User & Date: | dan 2009-12-01 15:04:33.000 |
Context
2009-12-01
| ||
17:05 | Add typedefs for i16 and u8 to fts3Int.h when not building via the amalgamation method. (check-in: fa56c1c472 user: dan tags: trunk) | |
15:04 | Add tests for the remaining examples in fts3.in. (check-in: e381cd5229 user: dan tags: trunk) | |
14:31 | Reorder function declarations in mutex_os2.c. This is a blind change - we have no capability of testing on OS/2. Ticket [97214a34d814] (check-in: c40e4ef094 user: drh tags: trunk) | |
Changes
Changes to test/e_fts3.test.
︙ | ︙ | |||
120 121 122 123 124 125 126 | # specifying an FTS3 table with no module arguments using a slightly # different syntax. ddl_test 1.1.8.1 {CREATE VIRTUAL TABLE data USING fts3;} read_test 1.1.8.2 {PRAGMA table_info(data)} {0 content {} 0 {} 0} ddl_test 1.1.8.3 {DROP TABLE data} ########################################################################## | < < | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | # specifying an FTS3 table with no module arguments using a slightly # different syntax. ddl_test 1.1.8.1 {CREATE VIRTUAL TABLE data USING fts3;} read_test 1.1.8.2 {PRAGMA table_info(data)} {0 content {} 0 {} 0} ddl_test 1.1.8.3 {DROP TABLE data} ########################################################################## # Test the examples in section 1.2 (populating fts3 tables) # ddl_test 1.2.1.1 { CREATE VIRTUAL TABLE pages USING fts3(title, body); } write_test 1.2.1.2 pages_content { INSERT INTO pages(docid, title, body) |
︙ | ︙ | |||
169 170 171 172 173 174 175 | write_test 1.2.2.3 docs_content { INSERT INTO docs VALUES('"which is for Solomon," meaning that'); } write_test 1.2.2.4 docs_content { INSERT INTO docs VALUES('the book is dedicated to Solomon.'); } read_test 1.2.2.5 { SELECT count(*) FROM docs_segdir } {3} | < | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | write_test 1.2.2.3 docs_content { INSERT INTO docs VALUES('"which is for Solomon," meaning that'); } write_test 1.2.2.4 docs_content { INSERT INTO docs VALUES('the book is dedicated to Solomon.'); } read_test 1.2.2.5 { SELECT count(*) FROM docs_segdir } {3} write_test 1.2.2.6 docs_segdir { SELECT * FROM (SELECT optimize(docs) FROM docs LIMIT 1) WHERE 0; } read_test 1.2.2.7 { SELECT count(*) FROM docs_segdir } {1} ddl_test 1.2.2.8 { DROP TABLE docs } ########################################################################## |
︙ | ︙ | |||
227 228 229 230 231 232 233 | read_test 1.3.3.3 { SELECT * FROM docs WHERE docs.docs MATCH 'sqlite' } {} read_test 1.3.3.4 { SELECT * FROM docs WHERE main.docs.docs MATCH 'sqlite' } {} do_error_test e_fts3-1.3.3.5 { SELECT * FROM docs WHERE main.docs MATCH 'sqlite' } {no such column: main.docs} ddl_test 1.3.2.8 { DROP TABLE docs } | < < | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | read_test 1.3.3.3 { SELECT * FROM docs WHERE docs.docs MATCH 'sqlite' } {} read_test 1.3.3.4 { SELECT * FROM docs WHERE main.docs.docs MATCH 'sqlite' } {} do_error_test e_fts3-1.3.3.5 { SELECT * FROM docs WHERE main.docs MATCH 'sqlite' } {no such column: main.docs} ddl_test 1.3.2.8 { DROP TABLE docs } ########################################################################## # Test the examples in section 3 (full-text index queries). # ddl_test 1.4.1.1 { CREATE VIRTUAL TABLE docs USING fts3(title, body) } foreach {tn title body} { 2 "linux driver" "a device" 3 "driver" "linguistic trick" |
︙ | ︙ | |||
293 294 295 296 297 298 299 | ddl_test 1.4.2.10 { DROP TABLE docs } ########################################################################## # Test the example in section 3.1 (set operators with enhanced syntax). # set sqlite_fts3_enable_parentheses 1 ddl_test 1.5.1.1 { CREATE VIRTUAL TABLE docs USING fts3() } | | > > > > > > > | < | < | > > > > > > > > > > > > > > | > > > > > | > > > > > > > | | > > > > | > > > > > | > > > > > > > > > > | > > | < > > | > | > > | < > > > > | | | | | | | | | > > > > > > > > > | > > > > > > > > | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 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 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | ddl_test 1.4.2.10 { DROP TABLE docs } ########################################################################## # Test the example in section 3.1 (set operators with enhanced syntax). # set sqlite_fts3_enable_parentheses 1 ddl_test 1.5.1.1 { CREATE VIRTUAL TABLE docs USING fts3() } foreach {tn docid content} { 2 1 "a database is a software system" 3 2 "sqlite is a software system" 4 3 "sqlite is a database" } { set R($docid) $content write_test 1.5.1.$tn docs_content { INSERT INTO docs(docid, content) VALUES($docid, $content) } } read_test 1.5.1.4 { SELECT * FROM docs WHERE docs MATCH 'sqlite AND database' } [list $R(3)] read_test 1.5.1.5 { SELECT * FROM docs WHERE docs MATCH 'database sqlite' } [list $R(3)] read_test 1.5.1.6 { SELECT * FROM docs WHERE docs MATCH 'sqlite OR database' } [list $R(1) $R(2) $R(3)] read_test 1.5.1.7 { SELECT * FROM docs WHERE docs MATCH 'database NOT sqlite' } [list $R(1)] read_test 1.5.1.8 { SELECT * FROM docs WHERE docs MATCH 'database and sqlite' } {} write_test 1.5.2.1 docs_content { INSERT INTO docs SELECT 'sqlite is also a library' UNION ALL SELECT 'library software' } read_test 1.5.2.2 { SELECT docid FROM docs WHERE docs MATCH 'sqlite AND database OR library' } {3 4 5} read_test 1.5.2.3 { SELECT docid FROM docs WHERE docs MATCH 'sqlite AND database' UNION SELECT docid FROM docs WHERE docs MATCH 'library' } {3 4 5} write_test 1.5.2.4 docs_content { INSERT INTO docs SELECT 'the sqlite library runs on linux' UNION ALL SELECT 'as does the sqlite database (on linux)' UNION ALL SELECT 'the sqlite database is accessed by the sqlite library' } read_test 1.5.2.2 { SELECT docid FROM docs WHERE docs MATCH '("sqlite database" OR "sqlite library") AND linux'; } {6 7} read_test 1.5.2.3 { SELECT docid FROM docs WHERE docs MATCH 'linux' INTERSECT SELECT docid FROM ( SELECT docid FROM docs WHERE docs MATCH '"sqlite library"' UNION SELECT docid FROM docs WHERE docs MATCH '"sqlite database"' ); } {6 7} ########################################################################## # Test the examples in section 3.2 (set operators with standard syntax). # These tests reuse the table populated by the block above. # set sqlite_fts3_enable_parentheses 0 read_test 1.6.1.1 { SELECT * FROM docs WHERE docs MATCH 'sqlite -database' } {{sqlite is a software system} {sqlite is also a library} {the sqlite library runs on linux}} read_test 1.6.1.2 { SELECT * FROM docs WHERE docs MATCH 'sqlite OR database library' } {{sqlite is also a library} {the sqlite library runs on linux} {the sqlite database is accessed by the sqlite library}} set sqlite_fts3_enable_parentheses 1 read_test 1.6.1.3 { SELECT * FROM docs WHERE docs MATCH 'sqlite OR database library' } {{sqlite is a software system} {sqlite is a database} {sqlite is also a library} {the sqlite library runs on linux} {as does the sqlite database (on linux)} {the sqlite database is accessed by the sqlite library}} read_test 1.6.1.4 { SELECT * FROM docs WHERE docs MATCH '(sqlite OR database) library' } {{sqlite is also a library} {the sqlite library runs on linux} {the sqlite database is accessed by the sqlite library}} set sqlite_fts3_enable_parentheses 0 ddl_test 1.6.1.5 { DROP TABLE docs } ########################################################################## # Test the examples in section 4 (auxillary functions). # ddl_test 1.7.1.1 { CREATE VIRTUAL TABLE mail USING fts3(subject, body) } write_test 1.7.1.2 mail_content { INSERT INTO mail VALUES( 'hello world', 'This message is a hello world message.'); } write_test 1.7.1.3 mail_content { INSERT INTO mail VALUES( 'urgent: serious', 'This mail is seen as a more serious mail'); } read_test 1.7.1.4 { SELECT offsets(mail) FROM mail WHERE mail MATCH 'world'; } {{0 0 6 5 1 0 24 5}} read_test 1.7.1.5 { SELECT offsets(mail) FROM mail WHERE mail MATCH 'message' } {{1 0 5 7 1 0 30 7}} read_test 1.7.1.6 { SELECT offsets(mail) FROM mail WHERE mail MATCH '"serious mail"' } {{1 0 28 7 1 1 36 4}} ddl_test 1.7.2.1 { CREATE VIRTUAL TABLE text USING fts3() } write_test 3.2.2 text_content { INSERT INTO text VALUES(' During 30 Nov-1 Dec, 2-3oC drops. Cool in the upper portion, minimum temperature 14-16oC and cool elsewhere, minimum temperature 17-20oC. Cold to very cold on mountaintops, minimum temperature 6-12oC. Northeasterly winds 15-30 km/hr. After that, temperature increases. Northeasterly winds 15-30 km/hr. '); } read_test 1.7.2.3 { SELECT snippet(text) FROM text WHERE text MATCH 'cold' } {{<b>...</b> elsewhere, minimum temperature 17-20oC. <b>Cold</b> to very <b>cold</b> on mountaintops, minimum <b>...</b>}} read_test 1.7.2.4 { SELECT snippet(text, '[', ']', '...') FROM text WHERE text MATCH '"min* tem*"' } {{... 2-3oC drops. Cool in the upper portion, [minimum] [temperature] 14-16oC and cool elsewhere, [minimum] ...}} ########################################################################## # Test the example in section 5 (custom tokenizers). # ddl_test 1.8.1.1 { CREATE VIRTUAL TABLE simple USING fts3(tokenize=simple) } write_test 1.8.1.2 simple_content { INSERT INTO simple VALUES('Right now they''re very frustrated') } read_test 1.8.1.3 {SELECT docid FROM simple WHERE simple MATCH 'Frustrated'} {1} read_test 1.8.1.4 {SELECT docid FROM simple WHERE simple MATCH 'Frustration'} {} ddl_test 1.8.2.1 { CREATE VIRTUAL TABLE porter USING fts3(tokenize=porter) } write_test 1.8.2.2 porter_content { INSERT INTO porter VALUES('Right now they''re very frustrated') } read_test 1.8.2.4 { SELECT docid FROM porter WHERE porter MATCH 'Frustration' } {1} } # End of tests of example code in fts3.html #------------------------------------------------------------------------- finish_test |