aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest13
-rw-r--r--manifest.uuid2
-rw-r--r--src/where.c14
-rw-r--r--test/expr.test67
4 files changed, 82 insertions, 14 deletions
diff --git a/manifest b/manifest
index 11a179cd3..40d2967ae 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C :-)\s(CVS\s12)
-D 2000-05-30T03:12:21
+C :-)\s(CVS\s13)
+D 2000-05-30T03:28:36
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 89921c1ee4de75275bfadfbac198396da31704d1
F README 6b5960603c7f8bf42fc022b4b6436f242f238dbb
@@ -19,9 +19,10 @@ F src/tokenize.c ab578d90ec6ab117b7ade6e6cfbcb5b0f9cad500
F src/util.c 321c136fc1a4d5821bad0f990c6374ef0785a118
F src/vdbe.c 80132b6bb9a744d1990a1c16666d54baaff2dbc3
F src/vdbe.h e721ad308f2e6ca805cebc4dd0a196ce4419d030
-F src/where.c 67ffea57920e16b33c580e9a9b9855b3ec9dea7b
+F src/where.c be3973952e9bb5d2bb0bc5523b03f5d1f9e9d6f9
F test/all.test 66a8a5b8291a472157944edcdce51a320ebd1f35
F test/delete.test 814d53e3b0d2d7069fb17e005d4041454d6585d4
+F test/expr.test 11e00880d2de0f60ff1ba7fdd4e09a0d72a01910
F test/index.test 8d4f26901a5582daa353fe3c8266cbf4a53af830
F test/insert.test 161bc67a4189738c559e3569323ceae31f4d49d6
F test/table.test b1afc2f6d4989f9ce911acbf711ac5d7ae521eb7
@@ -36,7 +37,7 @@ F tool/renumberOps.awk 6d067177ad5f8d711b79577b462da9b3634bd0a9
F www/c_interface.tcl f875864edf7974157d1c257ca08de854660882a5
F www/index.tcl 2466d1b2e26c6f354b0acedee12025309a216799
F www/sqlite.tcl 947e067bcc347dc767af4c1a6e5a8d47d8404aa3
-P 9818723ee127bc535e79f6876546cc027b4999e6
-R 1a430f86cc22b988f5aa7dc8de33740d
+P 20f2811fc19f937ed03bdb0e9d87a40c75452b17
+R a5c212fd65bac2f4b07651714ab486bf
U drh
-Z 3a408137acde4ba4c4136a81536a81e2
+Z 182f1f474f82d5f20dd5789e51b5d83f
diff --git a/manifest.uuid b/manifest.uuid
index 6fe94e9d6..a80c349ce 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-20f2811fc19f937ed03bdb0e9d87a40c75452b17 \ No newline at end of file
+191a7f484e0a10839e7e1c8eb6658536643e4756 \ No newline at end of file
diff --git a/src/where.c b/src/where.c
index ea15a5eeb..a481b54fc 100644
--- a/src/where.c
+++ b/src/where.c
@@ -25,7 +25,7 @@
** the WHERE clause of SQL statements. Also found here are subroutines
** to generate VDBE code to evaluate expressions.
**
-** $Id: where.c,v 1.1 2000/05/29 14:26:02 drh Exp $
+** $Id: where.c,v 1.2 2000/05/30 03:28:36 drh Exp $
*/
#include "sqliteInt.h"
@@ -367,12 +367,12 @@ void sqliteExprCode(Parse *pParse, Expr *pExpr){
case TK_SLASH: op = OP_Divide; break;
case TK_AND: op = OP_And; break;
case TK_OR: op = OP_Or; break;
- case TK_LT: op = OP_Lt; break;
- case TK_LE: op = OP_Le; break;
- case TK_GT: op = OP_Gt; break;
- case TK_GE: op = OP_Ge; break;
- case TK_NE: op = OP_Ne; break;
- case TK_EQ: op = OP_Eq; break;
+ case TK_LT: op = OP_Ge; break;
+ case TK_LE: op = OP_Gt; break;
+ case TK_GT: op = OP_Le; break;
+ case TK_GE: op = OP_Lt; break;
+ case TK_NE: op = OP_Eq; break;
+ case TK_EQ: op = OP_Ne; break;
case TK_ISNULL: op = OP_IsNull; break;
case TK_NOTNULL: op = OP_NotNull; break;
case TK_NOT: op = OP_Not; break;
diff --git a/test/expr.test b/test/expr.test
new file mode 100644
index 000000000..306092416
--- /dev/null
+++ b/test/expr.test
@@ -0,0 +1,67 @@
+# Copyright (c) 1999, 2000 D. Richard Hipp
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+# Author contact information:
+# drh@hwaci.com
+# http://www.hwaci.com/drh/
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this file is testing expressions.
+#
+# $Id: expr.test,v 1.1 2000/05/30 03:28:36 drh Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# Create a table to work with.
+#
+execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)}
+execsql {INSERT INTO test1 VALUES(1,2,1.1,2.2,'hello','world')}
+proc test_expr {name settings expr result} {
+ do_test $name [format {
+ execsql {UPDATE test1 SET %s}
+ execsql {SELECT %s FROM test1}
+ } $settings $expr] $result
+}
+
+test_expr expr-1.1 {i1=10, i2=20} {i1+i2} 30
+test_expr expr-1.2 {i1=10, i2=20} {i1-i2} -10
+test_expr expr-1.3 {i1=10, i2=20} {i1*i2} 200
+test_expr expr-1.4 {i1=10, i2=20} {i1/i2} 0.5
+test_expr expr-1.5 {i1=10, i2=20} {i2/i1} 2
+test_expr expr-1.6 {i1=10, i2=20} {i2<i1} 0
+test_expr expr-1.7 {i1=10, i2=20} {i2<=i1} 0
+test_expr expr-1.8 {i1=10, i2=20} {i2>i1} 1
+test_expr expr-1.9 {i1=10, i2=20} {i2>=i1} 1
+test_expr expr-1.10 {i1=10, i2=20} {i2!=i1} 1
+test_expr expr-1.11 {i1=10, i2=20} {i2=i1} 0
+test_expr expr-1.12 {i1=10, i2=20} {i2<>i1} 1
+test_expr expr-1.13 {i1=10, i2=20} {i2==i1} 0
+test_expr expr-1.14 {i1=20, i2=20} {i2<i1} 0
+test_expr expr-1.15 {i1=20, i2=20} {i2<=i1} 1
+test_expr expr-1.16 {i1=20, i2=20} {i2>i1} 0
+test_expr expr-1.17 {i1=20, i2=20} {i2>=i1} 1
+test_expr expr-1.18 {i1=20, i2=20} {i2!=i1} 0
+test_expr expr-1.19 {i1=20, i2=20} {i2=i1} 1
+test_expr expr-1.20 {i1=20, i2=20} {i2<>i1} 0
+test_expr expr-1.21 {i1=20, i2=20} {i2==i1} 1
+test_expr expr-1.22 {i1=1, i2=2, r1=3.0} {i1+i2*r1} {7}
+test_expr expr-1.23 {i1=1, i2=2, r1=3.0} {(i1+i2)*r1} {9}
+
+
+finish_test