sqlite/test/fts3aux2.test
dan a4bbc8b119 Add the "languageid" hidden column to fts4aux.
FossilOrigin-Name: 891df358e51075fb937f34952ce43bf51130b0d0
2013-10-15 19:06:17 +00:00

145 lines
3.6 KiB
Plaintext

# 2011 January 27
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The
# focus of this script is testing the FTS3 module.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !fts3 { finish_test ; return }
set ::testprefix fts3aux2
do_execsql_test 1.1 {
CREATE VIRTUAL TABLE t1 USING fts4(a, b, languageid=l);
INSERT INTO t1(a, b, l) VALUES
('zero zero', 'zero zero', 0),
('one two', 'three four', 1),
('five six', 'seven eight', 2)
;
CREATE VIRTUAL TABLE terms USING fts4aux(t1);
} {}
do_execsql_test 1.2.1 {
SELECT term, documents, occurrences, languageid FROM terms WHERE col = '*';
} {zero 1 4 0}
do_execsql_test 1.2.2 {
SELECT * FROM terms;
} {zero * 1 4 zero 0 1 2 zero 1 1 2}
do_execsql_test 1.2.3 {
SELECT * FROM terms WHERE languageid='';
} {}
do_execsql_test 1.2.4 {
SELECT * FROM terms WHERE languageid=-1;
} {}
do_execsql_test 1.2.5 {
SELECT * FROM terms WHERE languageid=9223372036854775807;
} {}
do_execsql_test 1.2.6 {
SELECT * FROM terms WHERE languageid=-9223372036854775808;
} {}
do_execsql_test 1.2.7 {
SELECT * FROM terms WHERE languageid=NULL;
} {}
do_execsql_test 1.3.1 {
SELECT term, documents, occurrences, languageid
FROM terms WHERE col = '*' AND languageid=1;
} {
four 1 1 1 one 1 1 1 three 1 1 1 two 1 1 1
}
do_execsql_test 1.3.2 {
SELECT term, col, documents, occurrences, languageid
FROM terms WHERE languageid=1;
} {
four * 1 1 1 four 1 1 1 1
one * 1 1 1 one 0 1 1 1
three * 1 1 1 three 1 1 1 1
two * 1 1 1 two 0 1 1 1
}
do_execsql_test 1.3.3 {
SELECT term, col, documents, occurrences, languageid
FROM terms WHERE languageid=1 AND term='zero'
} {
}
do_execsql_test 1.3.4 {
SELECT term, col, documents, occurrences, languageid
FROM terms WHERE languageid='1' AND term='two'
} {
two * 1 1 1 two 0 1 1 1
}
do_execsql_test 1.3.5 {
SELECT term, col, documents, occurrences, languageid
FROM terms WHERE languageid='+1' AND term>'four'
} {
one * 1 1 1 one 0 1 1 1
three * 1 1 1 three 1 1 1 1
two * 1 1 1 two 0 1 1 1
}
do_execsql_test 1.4.1 {
SELECT term, documents, occurrences, languageid
FROM terms WHERE col = '*' AND languageid=2;
} {
eight 1 1 2 five 1 1 2 seven 1 1 2 six 1 1 2
}
do_execsql_test 1.4.2 {
SELECT term, col, documents, occurrences, languageid
FROM terms WHERE languageid=2;
} {
eight * 1 1 2 eight 1 1 1 2
five * 1 1 2 five 0 1 1 2
seven * 1 1 2 seven 1 1 1 2
six * 1 1 2 six 0 1 1 2
}
do_execsql_test 1.4.3 {
SELECT term, col, documents, occurrences, languageid
FROM terms WHERE languageid=2 AND term='five';
} {
five * 1 1 2 five 0 1 1 2
}
do_execsql_test 1.4.4 {
SELECT term, col, documents, occurrences, languageid
FROM terms WHERE term='five' AND languageid=2
} {
five * 1 1 2 five 0 1 1 2
}
do_execsql_test 1.4.5 {
SELECT term, col, documents, occurrences, languageid
FROM terms WHERE term>='seven' AND languageid=2
} {
seven * 1 1 2 seven 1 1 1 2
six * 1 1 2 six 0 1 1 2
}
do_execsql_test 1.4.6 {
SELECT term, col, documents, occurrences, languageid
FROM terms WHERE term>='e' AND term<'seven' AND languageid=2
} {
eight * 1 1 2 eight 1 1 1 2
five * 1 1 2 five 0 1 1 2
}
finish_test