Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/test/genesis.tcl

Issue 883353008: [sql] Import reference version of SQLite 3.8.7.4. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hold back encoding change which is messing up patch. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # 2010 February 02 1 # 2010 February 02
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #************************************************************************* 10 #*************************************************************************
11 # This file implements regression tests for SQLite library. The 11 # This file implements a TCL function that fills an FTS table with
12 # focus of this script is testing the FTS4 module. 12 # lots of content useful for testing. This routine is broken out into
13 # 13 # a separate file to facilitate its use by multiple test scripts.
14 # 14 #
15 15
16 set testdir [file dirname $argv0] 16 # The fts_kjv_genesis routine is already loaded. This script is a no-op.
17 source $testdir/tester.tcl 17 if {[lsearch [info procs] fts_kjv_genesis]>=0} return
18 18
19 # If SQLITE_ENABLE_FTS3 is defined, omit this file. 19 # This procedure fills an existing FTS3/FTS4 table with many entries.
20 ifcapable !fts3 { 20 # The table needs to have a single column (other than docid) named "words".
21 finish_test 21 #
22 return 22 proc fts_kjv_genesis {} {
23 }
24 if {[db eval {SELECT sqlite_compileoption_used('ENABLE_FTS4')}]==0} {
25 finish_test
26 return
27 }
28
29 do_test fts4aa-1.0 {
30 db eval { 23 db eval {
31 CREATE VIRTUAL TABLE t1 USING fts4(words, tokenize porter);
32 BEGIN TRANSACTION; 24 BEGIN TRANSACTION;
33 INSERT INTO t1(docid,words) VALUES(1001001,'In the beginning God created the hea ven and the earth.'); 25 INSERT INTO t1(docid,words) VALUES(1001001,'In the beginning God created the hea ven and the earth.');
34 INSERT INTO t1(docid,words) VALUES(1001002,'And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved up on the face of the waters.'); 26 INSERT INTO t1(docid,words) VALUES(1001002,'And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved up on the face of the waters.');
35 INSERT INTO t1(docid,words) VALUES(1001003,'And God said, Let there be light: an d there was light.'); 27 INSERT INTO t1(docid,words) VALUES(1001003,'And God said, Let there be light: an d there was light.');
36 INSERT INTO t1(docid,words) VALUES(1001004,'And God saw the light, that it was g ood: and God divided the light from the darkness.'); 28 INSERT INTO t1(docid,words) VALUES(1001004,'And God saw the light, that it was g ood: and God divided the light from the darkness.');
37 INSERT INTO t1(docid,words) VALUES(1001005,'And God called the light Day, and th e darkness he called Night. And the evening and the morning were the first day.' ); 29 INSERT INTO t1(docid,words) VALUES(1001005,'And God called the light Day, and th e darkness he called Night. And the evening and the morning were the first day.' );
38 INSERT INTO t1(docid,words) VALUES(1001006,'And God said, Let there be a firmame nt in the midst of the waters, and let it divide the waters from the waters.'); 30 INSERT INTO t1(docid,words) VALUES(1001006,'And God said, Let there be a firmame nt in the midst of the waters, and let it divide the waters from the waters.');
39 INSERT INTO t1(docid,words) VALUES(1001007,'And God made the firmament, and divi ded the waters which were under the firmament from the waters which were above t he firmament: and it was so.'); 31 INSERT INTO t1(docid,words) VALUES(1001007,'And God made the firmament, and divi ded the waters which were under the firmament from the waters which were above t he firmament: and it was so.');
40 INSERT INTO t1(docid,words) VALUES(1001008,'And God called the firmament Heaven. And the evening and the morning were the second day.'); 32 INSERT INTO t1(docid,words) VALUES(1001008,'And God called the firmament Heaven. And the evening and the morning were the second day.');
41 INSERT INTO t1(docid,words) VALUES(1001009,'And God said, Let the waters under t he heaven be gathered together unto one place, and let the dry land appear: and it was so.'); 33 INSERT INTO t1(docid,words) VALUES(1001009,'And God said, Let the waters under t he heaven be gathered together unto one place, and let the dry land appear: and it was so.');
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 INSERT INTO t1(docid,words) VALUES(1050019,'And Joseph said unto them, Fear not: for am I in the place of God?'); 1550 INSERT INTO t1(docid,words) VALUES(1050019,'And Joseph said unto them, Fear not: for am I in the place of God?');
1559 INSERT INTO t1(docid,words) VALUES(1050020,'But as for you, ye thought evil agai nst me; but God meant it unto good, to bring to pass, as it is this day, to save much people alive.'); 1551 INSERT INTO t1(docid,words) VALUES(1050020,'But as for you, ye thought evil agai nst me; but God meant it unto good, to bring to pass, as it is this day, to save much people alive.');
1560 INSERT INTO t1(docid,words) VALUES(1050021,'Now therefore fear ye not: I will no urish you, and your little ones. And he comforted them, and spake kindly unto th em.'); 1552 INSERT INTO t1(docid,words) VALUES(1050021,'Now therefore fear ye not: I will no urish you, and your little ones. And he comforted them, and spake kindly unto th em.');
1561 INSERT INTO t1(docid,words) VALUES(1050022,'And Joseph dwelt in Egypt, he, and h is father''s house: and Joseph lived an hundred and ten years.'); 1553 INSERT INTO t1(docid,words) VALUES(1050022,'And Joseph dwelt in Egypt, he, and h is father''s house: and Joseph lived an hundred and ten years.');
1562 INSERT INTO t1(docid,words) VALUES(1050023,'And Joseph saw Ephraim''s children o f the third generation: the children also of Machir the son of Manasseh were bro ught up upon Joseph''s knees.'); 1554 INSERT INTO t1(docid,words) VALUES(1050023,'And Joseph saw Ephraim''s children o f the third generation: the children also of Machir the son of Manasseh were bro ught up upon Joseph''s knees.');
1563 INSERT INTO t1(docid,words) VALUES(1050024,'And Joseph said unto his brethren, I die: and God will surely visit you, and bring you out of this land unto the lan d which he sware to Abraham, to Isaac, and to Jacob.'); 1555 INSERT INTO t1(docid,words) VALUES(1050024,'And Joseph said unto his brethren, I die: and God will surely visit you, and bring you out of this land unto the lan d which he sware to Abraham, to Isaac, and to Jacob.');
1564 INSERT INTO t1(docid,words) VALUES(1050025,'And Joseph took an oath of the child ren of Israel, saying, God will surely visit you, and ye shall carry up my bones from hence.'); 1556 INSERT INTO t1(docid,words) VALUES(1050025,'And Joseph took an oath of the child ren of Israel, saying, God will surely visit you, and ye shall carry up my bones from hence.');
1565 INSERT INTO t1(docid,words) VALUES(1050026,'So Joseph died, being an hundred and ten years old: and they embalmed him, and he was put in a coffin in Egypt.'); 1557 INSERT INTO t1(docid,words) VALUES(1050026,'So Joseph died, being an hundred and ten years old: and they embalmed him, and he was put in a coffin in Egypt.');
1566 COMMIT; 1558 COMMIT;
1567 } 1559 }
1568 } {}
1569
1570
1571 do_test fts4aa-1.1 {
1572 db eval {
1573 SELECT docid FROM t1 EXCEPT SELECT docid FROM t1_docsize
1574 }
1575 } {}
1576 do_test fts4aa-1.2 {
1577 db eval {
1578 SELECT docid FROM t1_docsize EXCEPT SELECT docid FROM t1
1579 }
1580 } {}
1581
1582 proc mit {blob} {
1583 set scan(littleEndian) i*
1584 set scan(bigEndian) I*
1585 binary scan $blob $scan($::tcl_platform(byteOrder)) r
1586 return $r
1587 } 1560 }
1588 db func mit mit
1589
1590 do_test fts4aa-2.1 {
1591 db eval {
1592 SELECT docid, mit(matchinfo(t1)) FROM t1 WHERE t1 MATCH 'melchizedek';
1593 }
1594 } {1014018 {1 1 1 1 1 1533 25 20}}
1595 do_test fts4aa-2.2 {
1596 db eval {
1597 SELECT docid, mit(matchinfo(t1)) FROM t1
1598 WHERE t1 MATCH 'spake hebrew'
1599 ORDER BY docid;
1600 }
1601 } {1039014 {2 1 1 40 40 1 6 6 1533 25 42} 1039017 {2 1 1 40 40 1 6 6 1533 25 26} }
1602 do_test fts4aa-2.3 {
1603 db eval {
1604 SELECT docid, mit(matchinfo(t1)) FROM t1
1605 WHERE t1 MATCH 'laban overtook jacob'
1606 ORDER BY docid;
1607 }
1608 } {1031025 {3 1 2 54 46 1 3 3 2 181 160 1533 25 24}}
1609
1610 do_test fts4aa-9.1 {
1611 db eval {
1612 DELETE FROM t1 WHERE docid!=1050026;
1613 SELECT hex(size) FROM t1_docsize;
1614 SELECT hex(value) FROM t1_stat;
1615 }
1616 } {17 0117}
1617
1618 do_test fts4aa-9.2 {
1619 db eval {
1620 SELECT docid FROM t1 EXCEPT SELECT docid FROM t1_docsize
1621 }
1622 } {}
1623 do_test fts4aa-9.3 {
1624 db eval {
1625 SELECT docid FROM t1_docsize EXCEPT SELECT docid FROM t1
1626 }
1627 } {}
1628 do_test fts4aa-9.4 {
1629 db eval {
1630 SELECT docid, mit(matchinfo(t1)) FROM t1
1631 WHERE t1 MATCH 'joseph died in egypt'
1632 ORDER BY docid;
1633 }
1634 } {1050026 {4 1 1 1 1 1 1 1 2 2 1 1 1 1 1 23 23}}
1635
1636 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/test/fuzzerfault.test ('k') | third_party/sqlite/sqlite-src-3080704/test/hexlit.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698