sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / ext / vec1 / test / vec1intck2.test
| 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 | |
| 14 | source [file join [file dirname [info script]] vec1_common.tcl] |
| 15 | set testprefix vec1intck2 |
| 16 | vec1_load db |
| 17 | |
| 18 | do_execsql_test 1.0 { |
| 19 | CREATE VIRTUAL TABLE mytbl USING vec1(a, b); |
| 20 | WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000 ) |
| 21 | INSERT INTO mytbl SELECT random_vector(32), 'val'||i FROM s; |
| 22 | } |
| 23 | |
| 24 | foreach {tn spec} { |
| 25 | 1 "{codesize: 8, nbucket: 8}" |
| 26 | 2 "{codesize: 8, nbucket: 8, residual: 0}" |
| 27 | } { |
| 28 | do_execsql_test 1.$tn.1 { |
| 29 | INSERT INTO mytbl(cmd, arg) VALUES('rebuild', ( |
| 30 | SELECT vec1_train(a, $spec) FROM mytbl |
| 31 | )); |
| 32 | } |
| 33 | |
| 34 | do_execsql_test 1.$tn.2 { |
| 35 | PRAGMA integrity_check |
| 36 | } {ok} |
| 37 | } |
| 38 | |
| 39 | finish_test |
| 40 |