From 7bb481fda9ecb134804b49c2ce77ca28f7eea583 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 30 Mar 2012 20:42:12 -0400 Subject: Imported Upstream version 2.0.3 --- test/where5.test | 288 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 test/where5.test (limited to 'test/where5.test') diff --git a/test/where5.test b/test/where5.test new file mode 100644 index 0000000..760224c --- /dev/null +++ b/test/where5.test @@ -0,0 +1,288 @@ +# 2007 June 8 +# +# 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 testing NULL comparisons in the WHERE clause. +# See ticket #2404. +# +# $Id: where5.test,v 1.2 2007/06/08 08:43:10 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# Build some test data +# +do_test where5-1.0 { + execsql { + CREATE TABLE t1(x TEXT); + CREATE TABLE t2(x INTEGER); + CREATE TABLE t3(x INTEGER PRIMARY KEY); + INSERT INTO t1 VALUES(-1); + INSERT INTO t1 VALUES(0); + INSERT INTO t1 VALUES(1); + INSERT INTO t2 SELECT * FROM t1; + INSERT INTO t3 SELECT * FROM t2; + } + execsql { + SELECT * FROM t1 WHERE x<0 + } +} {-1} +do_test where5-1.1 { + execsql { + SELECT * FROM t1 WHERE x<=0 + } +} {-1 0} +do_test where5-1.2 { + execsql { + SELECT * FROM t1 WHERE x=0 + } +} {0} +do_test where5-1.3 { + execsql { + SELECT * FROM t1 WHERE x>=0 + } +} {0 1} +do_test where5-1.4 { + execsql { + SELECT * FROM t1 WHERE x>0 + } +} {1} +do_test where5-1.5 { + execsql { + SELECT * FROM t1 WHERE x<>0 + } +} {-1 1} +do_test where5-1.6 { + execsql { + SELECT * FROM t1 WHERE x=NULL + } +} {} +do_test where5-1.10 { + execsql { + SELECT * FROM t1 WHERE x>NULL + } +} {} +do_test where5-1.11 { + execsql { + SELECT * FROM t1 WHERE x!=NULL + } +} {} +do_test where5-1.12 { + execsql { + SELECT * FROM t1 WHERE x IS NULL + } +} {} +do_test where5-1.13 { + execsql { + SELECT * FROM t1 WHERE x IS NOT NULL + } +} {-1 0 1} + + +do_test where5-2.0 { + execsql { + SELECT * FROM t2 WHERE x<0 + } +} {-1} +do_test where5-2.1 { + execsql { + SELECT * FROM t2 WHERE x<=0 + } +} {-1 0} +do_test where5-2.2 { + execsql { + SELECT * FROM t2 WHERE x=0 + } +} {0} +do_test where5-2.3 { + execsql { + SELECT * FROM t2 WHERE x>=0 + } +} {0 1} +do_test where5-2.4 { + execsql { + SELECT * FROM t2 WHERE x>0 + } +} {1} +do_test where5-2.5 { + execsql { + SELECT * FROM t2 WHERE x<>0 + } +} {-1 1} +do_test where5-2.6 { + execsql { + SELECT * FROM t2 WHERE x=NULL + } +} {} +do_test where5-2.10 { + execsql { + SELECT * FROM t2 WHERE x>NULL + } +} {} +do_test where5-2.11 { + execsql { + SELECT * FROM t2 WHERE x!=NULL + } +} {} +do_test where5-2.12 { + execsql { + SELECT * FROM t2 WHERE x IS NULL + } +} {} +do_test where5-2.13 { + execsql { + SELECT * FROM t2 WHERE x IS NOT NULL + } +} {-1 0 1} + + +do_test where5-3.0 { + execsql { + SELECT * FROM t3 WHERE x<0 + } +} {-1} +do_test where5-3.1 { + execsql { + SELECT * FROM t3 WHERE x<=0 + } +} {-1 0} +do_test where5-3.2 { + execsql { + SELECT * FROM t3 WHERE x=0 + } +} {0} +do_test where5-3.3 { + execsql { + SELECT * FROM t3 WHERE x>=0 + } +} {0 1} +do_test where5-3.4 { + execsql { + SELECT * FROM t3 WHERE x>0 + } +} {1} +do_test where5-3.5 { + execsql { + SELECT * FROM t3 WHERE x<>0 + } +} {-1 1} +do_test where5-3.6 { + execsql { + SELECT * FROM t3 WHERE x=NULL + } +} {} +do_test where5-3.10 { + execsql { + SELECT * FROM t3 WHERE x>NULL + } +} {} +do_test where5-3.11 { + execsql { + SELECT * FROM t3 WHERE x!=NULL + } +} {} +do_test where5-3.12 { + execsql { + SELECT * FROM t3 WHERE x IS NULL + } +} {} +do_test where5-3.13 { + execsql { + SELECT * FROM t3 WHERE x IS NOT NULL + } +} {-1 0 1} + +do_test where5-4.0 { + execsql { + SELECT xNULL FROM t3 + } +} {{} {} {}} +do_test where5-4.4 { + execsql { + SELECT x>=NULL FROM t3 + } +} {{} {} {}} +do_test where5-4.5 { + execsql { + SELECT x!=NULL FROM t3 + } +} {{} {} {}} +do_test where5-4.6 { + execsql { + SELECT x IS NULL FROM t3 + } +} {0 0 0} +do_test where5-4.7 { + execsql { + SELECT x IS NOT NULL FROM t3 + } +} {1 1 1} + +finish_test -- cgit v1.2.3