1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix octet_length() test cases so that they work when the database encoding

is utf16.

FossilOrigin-Name: ad2e39626e6115fd322ef9495ae3bcd91343d7131a725f1bf24211a51a21dcc2
This commit is contained in:
drh
2023-07-06 17:14:47 +00:00
parent 59f13119cf
commit 3e1e7aad3d
3 changed files with 11 additions and 11 deletions

View File

@ -42,9 +42,10 @@ do_test func-0.1 {
do_test func-1.0 {
execsql {SELECT length(t1) FROM tbl1 ORDER BY t1}
} {4 2 7 8 4}
set isutf16 [regexp 16 [db one {PRAGMA encoding}]]
do_execsql_test func-1.0b {
SELECT octet_length(t1) FROM tbl1 ORDER BY t1;
} {4 2 7 8 4}
} [expr {$isutf16?"8 4 14 16 8":"4 2 7 8 4"}]
do_test func-1.1 {
set r [catch {execsql {SELECT length(*) FROM tbl1 ORDER BY t1}} msg]
lappend r $msg
@ -62,14 +63,14 @@ do_test func-1.4 {
} {1 -1 3 -1 5}
do_execsql_test func-1.5 {
SELECT octet_length(12345);
} {5}
} [expr {(1+($isutf16!=0))*5}]
db null NULL
do_execsql_test func-1.6 {
SELECT octet_length(NULL);
} {NULL}
do_execsql_test func-1.7 {
SELECT octet_length(7.5);
} {3}
} [expr {(1+($isutf16!=0))*3}]
do_execsql_test func-1.8 {
SELECT octet_length(x'30313233');
} {4}