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 / vec1 / test / vec1fault7.test

65 lines · 1523 bytes Raw Blame History
1# 2026-04-01
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#
13
14source [file join [file dirname [info script]] vec1_common.tcl]
15set testprefix vec1fault7
16
17vec1_load db
18
19do_execsql_test 1 {
20 CREATE VIRTUAL TABLE t1 USING vec1(v, b);
21 INSERT INTO t1 VALUES(random_vector(8), 10);
22 INSERT INTO t1 VALUES(random_vector(8), 20);
23 INSERT INTO t1 VALUES(random_vector(8), 30);
24 INSERT INTO t1 VALUES(random_vector(8), 40);
25 INSERT INTO t1 VALUES(random_vector(8), 50);
26
27 INSERT INTO t1(cmd, arg) VALUES('rebuild', '{index:"flat"}');
28}
29
30faultsim_save_and_close
31do_faultsim_test 1 -faults oom* -prep {
32 faultsim_restore_and_reopen
33 vec1_load db
34} -body {
35 execsql {
36 SELECT rowid, length(v)
37 FROM t1(random_vector(8), '{K:10}')
38 WHERE b IN (10, 30, 50)
39 ORDER BY 1;
40 }
41} -test {
42 faultsim_test_result {0 {1 32 3 32 5 32}}
43}
44
45do_execsql_test 2 {
46 INSERT INTO t1(cmd, arg) VALUES('rebuild', '{index:"none"}');
47}
48
49faultsim_save_and_close
50do_faultsim_test 2 -faults oom* -prep {
51 faultsim_restore_and_reopen
52 vec1_load db
53} -body {
54 execsql {
55 SELECT rowid
56 FROM t1(random_vector(8), '{K:10}')
57 WHERE b IN (10, 30, 50)
58 ORDER BY 1;
59 }
60} -test {
61 faultsim_test_result {0 {1 3 5}}
62}
63
64finish_test
65