limbo/testing/boolean.test
2025-04-13 22:38:43 -03:00

56 lines
No EOL
1.5 KiB
Tcl
Executable file

#!/usr/bin/env tclsh
set testdir [file dirname $argv0]
source $testdir/tester.tcl
foreach {testname lhs ans} {
int-1 1 0
int-2 2 0
int-3 0 1
float-1 1.0 0
float-2 2.0 0
float-3 0.0 1
text 'a' 1
text-int-1 '0' 1
text-int-2 '1' 0
text-float-1 '1.0' 0
text-float-2 '0.0' 1
text-float-edge '12-23.0' 0
null NULL {}
empty-blob x'' 1
cast-blob "CAST ('af' AS BLOB)" 1
blob x'0000' 1
blob-2 x'0001' 1
} {
do_execsql_test boolean-not-$testname "SELECT not $lhs" $::ans
}
foreach {testname lhs rhs ans} {
blob-blob x'' x'' 0
1-blob 1 x'' 0
0-blob 0 x'' 0
0-1 0 1 0
1-1 1 1 1
int-int 20 1000 1
int-float 20 1.0 1
int-0.0 20 0.0 0
0.0-0.0 0.0 0.0 0
text 'a' 1 0
text-int-1 '0' 1 0
text-int-2 '1' 0 0
text-float-1 '1.0' 0 0
text-float-2 '0.0' 1 0
text-float-3 '1.0' 1 1
text-float-edge '12-23.0' 0 0
null-null NULL NULL ""
1-null 1 NULL ""
1.0-null 1.0 NULL ""
blob-null x'' NULL 0
blob2-null x'0001' NULL 0
0-null 0 NULL 0
0.0-null 0.0 NULL 0
'0.0'-null '0.0' NULL 0
} {
do_execsql_test boolean-and-$testname "SELECT $lhs AND $rhs" $::ans
}