Add Null comparision tests

This commit is contained in:
psvri 2025-01-19 00:10:34 +05:30
parent 4a41736f89
commit 554244209d

View file

@ -6,6 +6,7 @@ source $testdir/tester.tcl
foreach {testname lhs rhs ans} {
int-int-1 8 1 0
int-int-2 8 8 1
int-null 8 NULL {}
} {
do_execsql_test compare-eq-$testname "SELECT $lhs = $rhs" $::ans
}
@ -13,6 +14,7 @@ foreach {testname lhs rhs ans} {
foreach {testname lhs rhs ans} {
float-float-1 8.0 1.0 0
float-float-2 8.0 8.0 1
float-null 8.0 NULL {}
} {
do_execsql_test compare-eq-$testname "SELECT $lhs = $rhs" $::ans
}
@ -20,6 +22,16 @@ foreach {testname lhs rhs ans} {
foreach {testname lhs rhs ans} {
text-text-1 'a' 'b' 0
text-text-2 'a' 'a' 1
text-null 'a' NULL {}
} {
do_execsql_test compare-eq-$testname "SELECT $lhs = $rhs" $::ans
}
foreach {testname lhs rhs ans} {
null-int NULL 1 {}
null-float NULL 1.0 {}
null-text NULL 'a' {}
null-null NULL NULL {}
} {
do_execsql_test compare-eq-$testname "SELECT $lhs = $rhs" $::ans
}
@ -27,6 +39,7 @@ foreach {testname lhs rhs ans} {
foreach {testname lhs rhs ans} {
int-int-1 8 1 1
int-int-2 8 8 0
int-null 8 NULL {}
} {
do_execsql_test compare-neq-$testname "SELECT $lhs <> $rhs" $::ans
}
@ -34,6 +47,7 @@ foreach {testname lhs rhs ans} {
foreach {testname lhs rhs ans} {
float-float-1 8.0 1.0 1
float-float-2 8.0 8.0 0
float-null 8.0 NULL {}
} {
do_execsql_test compare-neq-$testname "SELECT $lhs <> $rhs" $::ans
}
@ -41,6 +55,16 @@ foreach {testname lhs rhs ans} {
foreach {testname lhs rhs ans} {
text-text-1 'a' 'b' 1
text-text-2 'a' 'a' 0
text-null 'a' NULL {}
} {
do_execsql_test compare-neq-$testname "SELECT $lhs <> $rhs" $::ans
}
foreach {testname lhs rhs ans} {
null-int NULL 1 {}
null-float NULL 1.0 {}
null-text NULL 'a' {}
null-null NULL NULL {}
} {
do_execsql_test compare-neq-$testname "SELECT $lhs <> $rhs" $::ans
}
@ -49,6 +73,7 @@ foreach {testname lhs rhs ans} {
int-int-1 1 8 0
int-int-2 1 1 0
int-int-3 8 0 1
int-null 8 NULL {}
} {
do_execsql_test compare-gt-$testname "SELECT $lhs > $rhs" $::ans
}
@ -57,6 +82,7 @@ foreach {testname lhs rhs ans} {
float-float-1 1.0 2.0 0
float-float-2 1.0 1.0 0
float-float-3 7.0 6.0 1
float-null 8.0 NULL {}
} {
do_execsql_test compare-gt-$testname "SELECT $lhs > $rhs" $::ans
}
@ -65,6 +91,16 @@ foreach {testname lhs rhs ans} {
text-text-1 'b' 'c' 0
text-text-2 'b' 'b' 0
text-text-3 'b' 'a' 1
text-null 'a' NULL {}
} {
do_execsql_test compare-gt-$testname "SELECT $lhs > $rhs" $::ans
}
foreach {testname lhs rhs ans} {
null-int NULL 1 {}
null-float NULL 1.0 {}
null-text NULL 'a' {}
null-null NULL NULL {}
} {
do_execsql_test compare-gt-$testname "SELECT $lhs > $rhs" $::ans
}
@ -73,6 +109,7 @@ foreach {testname lhs rhs ans} {
int-int-1 1 8 0
int-int-2 1 1 1
int-int-3 8 0 1
int-null 8 NULL {}
} {
do_execsql_test compare-gte-$testname "SELECT $lhs >= $rhs" $::ans
}
@ -81,6 +118,7 @@ foreach {testname lhs rhs ans} {
float-float-1 1.0 2.0 0
float-float-2 1.0 1.0 1
float-float-3 7.0 6.0 1
float-null 8.0 NULL {}
} {
do_execsql_test compare-gte-$testname "SELECT $lhs >= $rhs" $::ans
}
@ -89,6 +127,16 @@ foreach {testname lhs rhs ans} {
text-text-1 'b' 'c' 0
text-text-2 'b' 'b' 1
text-text-3 'b' 'a' 1
text-null 'a' NULL {}
} {
do_execsql_test compare-gte-$testname "SELECT $lhs >= $rhs" $::ans
}
foreach {testname lhs rhs ans} {
null-int NULL 1 {}
null-float NULL 1.0 {}
null-text NULL 'a' {}
null-null NULL NULL {}
} {
do_execsql_test compare-gte-$testname "SELECT $lhs >= $rhs" $::ans
}
@ -97,6 +145,7 @@ foreach {testname lhs rhs ans} {
int-int-1 1 8 1
int-int-2 1 1 0
int-int-3 8 0 0
int-null 8 NULL {}
} {
do_execsql_test compare-lt-$testname "SELECT $lhs < $rhs" $::ans
}
@ -105,6 +154,7 @@ foreach {testname lhs rhs ans} {
float-float-1 1.0 2.0 1
float-float-2 1.0 1.0 0
float-float-3 7.0 6.0 0
float-null 8.0 NULL {}
} {
do_execsql_test compare-lt-$testname "SELECT $lhs < $rhs" $::ans
}
@ -113,6 +163,16 @@ foreach {testname lhs rhs ans} {
text-text-1 'b' 'c' 1
text-text-2 'b' 'b' 0
text-text-3 'b' 'a' 0
text-null 'a' NULL {}
} {
do_execsql_test compare-lt-$testname "SELECT $lhs < $rhs" $::ans
}
foreach {testname lhs rhs ans} {
null-int NULL 1 {}
null-float NULL 1.0 {}
null-text NULL 'a' {}
null-null NULL NULL {}
} {
do_execsql_test compare-lt-$testname "SELECT $lhs < $rhs" $::ans
}
@ -121,6 +181,7 @@ foreach {testname lhs rhs ans} {
int-int-1 1 8 1
int-int-2 1 1 1
int-int-3 8 0 0
int-null 8 NULL {}
} {
do_execsql_test compare-lte-$testname "SELECT $lhs <= $rhs" $::ans
}
@ -129,6 +190,7 @@ foreach {testname lhs rhs ans} {
float-float-1 1.0 2.0 1
float-float-2 1.0 1.0 1
float-float-3 7.0 6.0 0
float-null 8.0 NULL {}
} {
do_execsql_test compare-lte-$testname "SELECT $lhs <= $rhs" $::ans
}
@ -137,6 +199,16 @@ foreach {testname lhs rhs ans} {
text-text-1 'b' 'c' 1
text-text-2 'b' 'b' 1
text-text-3 'b' 'a' 0
text-null 'a' NULL {}
} {
do_execsql_test compare-lte-$testname "SELECT $lhs <= $rhs" $::ans
}
foreach {testname lhs rhs ans} {
null-int NULL 1 {}
null-float NULL 1.0 {}
null-text NULL 'a' {}
null-null NULL NULL {}
} {
do_execsql_test compare-lte-$testname "SELECT $lhs <= $rhs" $::ans
}