mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Add experimental user function unhex().
FossilOrigin-Name: dbe424b5db33ce2c7562dfb44daf2969cf3074234cc891eb9b8d0d907faf6a78
This commit is contained in:
57
test/unhex.test
Normal file
57
test/unhex.test
Normal file
@ -0,0 +1,57 @@
|
||||
# 2023 January 23
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source [file join $testdir tester.tcl]
|
||||
|
||||
set testprefix unhex
|
||||
|
||||
|
||||
foreach {tn hex} {
|
||||
1 0000
|
||||
2 FFFF
|
||||
3 0123456789ABCDEF
|
||||
} {
|
||||
do_execsql_test 1.$tn.1 {
|
||||
SELECT hex( unhex( $hex ) );
|
||||
} $hex
|
||||
|
||||
do_execsql_test 1.$tn.2 {
|
||||
SELECT hex( unhex( lower( $hex ) ) );
|
||||
} $hex
|
||||
}
|
||||
|
||||
do_execsql_test 2.0 {
|
||||
SELECT typeof( unhex('') ), length( unhex('') );
|
||||
} {blob 0}
|
||||
|
||||
foreach {tn hex} {
|
||||
1 ABC
|
||||
2 hello
|
||||
3 123456x7
|
||||
4 0xff
|
||||
} {
|
||||
do_execsql_test 2.$tn {
|
||||
SELECT unhex( $hex ) IS NULL;
|
||||
} 1
|
||||
}
|
||||
|
||||
do_catchsql_test 3.0 {
|
||||
SELECT unhex();
|
||||
} {1 {wrong number of arguments to function unhex()}}
|
||||
do_catchsql_test 3.1 {
|
||||
SELECT unhex('ABCD', '1234');
|
||||
} {1 {wrong number of arguments to function unhex()}}
|
||||
|
||||
finish_test
|
||||
|
||||
|
Reference in New Issue
Block a user