mirror of
https://github.com/sqlite/sqlite.git
synced 2026-10-23 21:49:02 +03:00
114 lines
3.6 KiB
Plaintext
114 lines
3.6 KiB
Plaintext
# 2026-04-01
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
#
|
|
#
|
|
|
|
source [file join [file dirname [info script]] vec1_common.tcl]
|
|
set testprefix vec1config
|
|
vec1_load db
|
|
|
|
do_execsql_test 1.0 { SELECT vec1_config('nthread'); } {1}
|
|
do_execsql_test 1.1 { SELECT vec1_config('nprobe'); } {0.05}
|
|
|
|
do_catchsql_test 1.2 {
|
|
SELECT vec1_config('nosuch');
|
|
} {1 {vec1: no such parameter: nosuch}}
|
|
|
|
do_catchsql_test 1.3.1 {
|
|
SELECT vec1_config('nthread', 0);
|
|
} {1 {vec1: nthread requires an integer value between 1 and 128}}
|
|
do_catchsql_test 1.3.2 {
|
|
SELECT vec1_config('nthread', 129);
|
|
} {1 {vec1: nthread requires an integer value between 1 and 128}}
|
|
do_test 1.3.3 {
|
|
catch { execsql { SELECT vec1_config('nthread', 128) } }
|
|
} {0}
|
|
do_catchsql_test 1.3.4 {
|
|
SELECT vec1_config('nthread', 1);
|
|
} {0 1}
|
|
|
|
do_catchsql_test 1.4.1 {
|
|
SELECT vec1_config('nprobe', -1);
|
|
} {1 {vec1: nprobe must be a numeric value greater than 0.0}}
|
|
do_catchsql_test 1.4.2 {
|
|
SELECT vec1_config('nprobe', 0.0);
|
|
} {1 {vec1: nprobe must be a numeric value greater than 0.0}}
|
|
do_catchsql_test 1.4.3 {
|
|
SELECT vec1_config('nprobe', 4.0);
|
|
} {0 4.0}
|
|
do_catchsql_test 1.4.4 {
|
|
SELECT vec1_config('nprobe', 'hello');
|
|
} {1 {vec1: nprobe must be a numeric value greater than 0.0}}
|
|
do_catchsql_test 1.4.5 {
|
|
SELECT vec1_config('nprobe', '1hello');
|
|
} {1 {vec1: nprobe must be a numeric value greater than 0.0}}
|
|
do_catchsql_test 1.4.6 {
|
|
SELECT vec1_config('nprobe', NULL);
|
|
} {1 {vec1: nprobe must be a numeric value greater than 0.0}}
|
|
|
|
do_catchsql_test 1.5.1 {
|
|
SELECT vec1_config('nthread', 'notaninteger');
|
|
} {1 {vec1: nthread requires an integer value between 1 and 128}}
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
do_execsql_test 2.0 {
|
|
CREATE VIRTUAL TABLE x1 USING vec1(v);
|
|
}
|
|
|
|
do_catchsql_test 2.1.1 {
|
|
SELECT * FROM x1(random_vector(8), '{nprobe: -1, K: 500}')
|
|
} {1 {vec1: nprobe must be a numeric value greater than 0.0}}
|
|
do_catchsql_test 2.1.2 {
|
|
SELECT * FROM x1(random_vector(8), '{nprobe: 0.0, K: 500}')
|
|
} {1 {vec1: nprobe must be a numeric value greater than 0.0}}
|
|
do_catchsql_test 2.1.3 {
|
|
SELECT * FROM x1(random_vector(8), '{nprobe: "world", K: 500}')
|
|
} {1 {vec1: nprobe must be a numeric value greater than 0.0}}
|
|
do_catchsql_test 2.1.4 {
|
|
SELECT * FROM x1(random_vector(8), '{nprobe: "2world", K: 500}')
|
|
} {1 {vec1: nprobe must be a numeric value greater than 0.0}}
|
|
do_catchsql_test 2.1.5 {
|
|
SELECT * FROM x1(random_vector(8), '{nprobe: 0.5, K: 500}')
|
|
} {0 {}}
|
|
|
|
do_catchsql_test 2.2.1 {
|
|
SELECT * FROM x1(random_vector(8), '{nprobe: 0.2, K: -1}')
|
|
} {1 {vec1: K must be an integer value between 0 and 33554432}}
|
|
|
|
do_catchsql_test 2.2.2 {
|
|
SELECT * FROM x1(random_vector(8), -1)
|
|
} {1 {vec1: K must be an integer value between 0 and 33554432}}
|
|
do_catchsql_test 2.2.3 {
|
|
SELECT * FROM x1(random_vector(8), '1hello')
|
|
} {1 {malformed JSON}}
|
|
do_catchsql_test 2.2.4 {
|
|
SELECT * FROM x1(random_vector(8), '5')
|
|
} {0 {}}
|
|
do_catchsql_test 2.2.5 {
|
|
SELECT * FROM x1(random_vector(8), 5.0)
|
|
} {0 {}}
|
|
do_catchsql_test 2.2.6 {
|
|
SELECT * FROM x1(random_vector(8), '64.0')
|
|
} {0 {}}
|
|
do_catchsql_test 2.2.7 {
|
|
SELECT * FROM x1(random_vector(8), 4.5)
|
|
} {1 {vec1: K must be an integer value between 0 and 33554432}}
|
|
|
|
do_catchsql_test 2.2.8 {
|
|
SELECT * FROM x1(random_vector(8), '{K:4.5}')
|
|
} {1 {vec1: K must be an integer value between 0 and 33554432}}
|
|
|
|
|
|
|
|
finish_test
|
|
|