Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/ext/vec1/test/vec1scalar.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / ext / vec1 / test / vec1scalar.test` 77 lines ยท 1869 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 14 source [file join [file dirname [info script]] vec1_common.tcl] 15 set testprefix vec1scalar 16 17 if {[catch { vec1_load_scalar db }]} { 18 puts "Skipping tests... vec1testscalar.so not built" 19 finish_test 20 return 21 } 22 23 do_execsql_test 1.0 { 24 CREATE VIRTUAL TABLE docs USING vec1(embedding, title, category); 25 } 26 do_execsql_test 1.1 { 27 INSERT INTO docs(rowid, embedding, title, category) 28 SELECT i, vec1_from_json('['||(SELECT group_concat(printf('%!.9g', 29 sin(i*0.7+j*1.3)*0.5 + cos(i*0.11*j+0.3)*0.5),',') 30 FROM (WITH RECURSIVE q(j) AS (SELECT 0 UNION ALL SELECT j+1 FROM q WHERE j<31) 31 SELECT j FROM q))||']'), 32 'runbook '||i, 33 CASE i%4 WHEN 0 THEN 'ops' WHEN 1 THEN 'kb' WHEN 2 THEN 'sec' ELSE 'net' END 34 FROM ( 35 WITH RECURSIVE r(i) AS (SELECT 1 UNION ALL SELECT i+1 FROM r WHERE i<700) 36 SELECT i FROM r 37 ); 38 } 39 40 do_execsql_test 1.2 { 41 INSERT INTO docs(cmd, arg) VALUES('rebuild', ( 42 SELECT vec1_train( 43 embedding,'{nbucket:8,codesize:8,quantizer:"bq",residual:0}' 44 ) FROM docs 45 )); 46 } 47 48 do_execsql_test 1.3 { 49 PRAGMA integrity_check 50 } {ok} 51 52 db close 53 sqlite3 db test.db 54 vec1_load db 55 56 do_execsql_test 1.4 { 57 PRAGMA integrity_check 58 } {ok} 59 60 do_execsql_test 1.5 { 61 INSERT INTO docs(cmd, arg) VALUES('rebuild', ( 62 SELECT vec1_train( 63 embedding,'{nbucket:8,codesize:8,quantizer:"bq",residual:0}' 64 ) FROM docs 65 )); 66 } 67 68 db close 69 sqlite3 db test.db 70 vec1_load_scalar db 71 72 do_execsql_test 1.6 { 73 PRAGMA integrity_check 74 } {ok} 75 76 finish_test 77