interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / fts5 / test / fts5ubsan.test

60 lines · 1419 bytes Raw Blame History
1# 2022 August 9
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# This test is focused on edge cases that cause ubsan errors.
13#
14
15source [file join [file dirname [info script]] fts5_common.tcl]
16set testprefix fts5ubsan
17
18# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
19ifcapable !fts5 {
20 finish_test
21 return
22}
23
24do_execsql_test 1.0 {
25 CREATE VIRTUAL TABLE x1 USING fts5(x);
26}
27
28set BIG 9000000000000000000
29set SMALL -9000000000000000000
30
31do_execsql_test 1.1 {
32 BEGIN;
33 INSERT INTO x1 (rowid, x) VALUES($BIG, 'aaa aba acc');
34 INSERT INTO x1 (rowid, x) VALUES($SMALL, 'aaa abc acb');
35 COMMIT;
36}
37
38do_execsql_test 1.2 {
39 SELECT rowid, x FROM x1('ab*');
40} [list $SMALL {aaa abc acb} $BIG {aaa aba acc}]
41
42do_execsql_test 1.3 {
43 SELECT rowid, x FROM x1('ac*');
44} [list $SMALL {aaa abc acb} $BIG {aaa aba acc}]
45
46reset_db
47do_execsql_test 2.0 {
48 CREATE VIRTUAL TABLE x1 USING fts5(x);
49}
50
51do_execsql_test 2.1 {
52 INSERT INTO x1 (rowid, x) VALUES($BIG, 'aaa aba acc');
53 INSERT INTO x1 (rowid, x) VALUES($SMALL, 'aaa abc acb');
54}
55
56do_execsql_test 2.2 {
57 INSERT INTO x1 (x1) VALUES('optimize');
58}
59
60finish_test