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 / vec1nan.test

48 lines · 1293 bytes Raw Blame History
1# 2026-08-04
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 vec1nan
16vec1_load db
17
18do_execsql_test 1.0 {
19 CREATE VIRTUAL TABLE vv USING vec1(v);
20}
21do_execsql_test 1.1 {
22 SELECT * FROM vv( vec1_from_json('[1,2,3,4,5,6,7,8,9]'), 10);
23} {}
24
25do_catchsql_test 1.2 {
26 SELECT * FROM vv(vec1_from_json('[1,2,3,4,5,6,7,8,NaN]'), 10);
27} {1 {vec1: non-finite value not allowed in vector}}
28
29do_catchsql_test 1.3 {
30 INSERT INTO vv(v) VALUES(vec1_from_json('[1,2,3,4,NaN,5,6,7,8,9]'));
31} {1 {vec1: non-finite value not allowed in vector}}
32
33do_execsql_test 1.4 {
34 CREATE TABLE tr(x);
35 WITH s(i) AS (
36 VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1000
37 )
38 INSERT INTO tr SELECT random_vector(9) FROM s;
39 INSERT INTO tr(x) VALUES(vec1_from_json('[1,2,3,4,NaN,5,6,7,8]'));
40}
41
42do_catchsql_test 1.5 {
43 SELECT vec1_train(x, '{codesize:4}') FROM tr
44} {1 {vec1_train: non-finite value not allowed in vector}}
45
46
47finish_test
48