Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

89 lines
2.1 KiB
Plaintext

# 2018-01-15
#
# 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.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The
# focus of this file is prefixes.c extension
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix unionvtab
ifcapable !vtab {
finish_test
return
}
load_static_extension db prefixes
foreach {tn zLeft zRight expected} {
1 abcdxxx abcyy 3
2 abcdxxx bcyyy 0
3 abcdxxx ab 2
4 ab abcd 2
5 "xyz\u1234xz" "xyz\u1234xy" 5
6 "xyz\u1234" "xyz\u1234xy" 4
7 "xyz\u1234" "xyz\u1234" 4
8 "xyz\u1234xy" "xyz\u1234" 4
9 "xyz\u1234xy" "xyz\u1233" 3
10 "xyz\u1234xy" "xyz\u1235" 3
} {
do_execsql_test 1.$tn { SELECT prefix_length($zLeft, $zRight) } $expected
}
do_execsql_test 2.0 {
CREATE TABLE t1(k TEXT UNIQUE, v INTEGER);
INSERT INTO t1 VALUES
('aback', 1),
('abaft', 2),
('abandon', 3),
('abandoned', 4),
('abandoning', 5),
('abandonment', 6),
('abandons', 7),
('abase', 8),
('abased', 9),
('abasement', 10),
('abasements', 11),
('abases', 12),
('abash', 13),
('abashed', 14),
('abashes', 15),
('abashing', 16),
('abasing', 17),
('abate', 18),
('abated', 19),
('abatement', 20),
('abatements', 21);
}
foreach {tn INPUT expected} {
1 abatementt abatement
2 abashet abash
3 abandonio abandon
4 abasemenu abase
} {
do_execsql_test 2.$tn {
WITH finder(str) AS (
SELECT (SELECT max(k) FROM t1 WHERE k<=$INPUT)
UNION ALL
SELECT (
SELECT max(k) FROM t1
WHERE k<=substr($INPUT, 1, prefix_length(finder.str, $INPUT))
) FROM finder WHERE length(finder.str)>0
)
SELECT str FROM finder WHERE length(str)==prefix_length(str, $INPUT) LIMIT 1
} $expected
}
finish_test