]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Test coverage improvements. (CVS 2215)
authordrh <drh@noemail.net>
Sat, 15 Jan 2005 01:52:31 +0000 (01:52 +0000)
committerdrh <drh@noemail.net>
Sat, 15 Jan 2005 01:52:31 +0000 (01:52 +0000)
FossilOrigin-Name: 92f9d2b2f480fccfa6e8b70a1d19058b92a4ea8f

manifest
manifest.uuid
src/date.c
src/expr.c
src/select.c
test/date.test
test/limit.test
test/select1.test

index 578c018c0837f4394837dbdd7983ea745e35a4d9..e27c4059e2290c868d7c6932ae2257c52a8d556f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improved\stest\scoverage\sfor\supdate.c.\s(CVS\s2214)
-D 2005-01-15T00:40:43
+C Test\scoverage\simprovements.\s(CVS\s2215)
+D 2005-01-15T01:52:32
 F Makefile.in 6ce51dde6a8fe82fc12f20dec750572f6a19f56a
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
@@ -33,9 +33,9 @@ F src/btree.c 01027e3c1b9f53f17eec964da2a3e45d253b2b87
 F src/btree.h 74d19cf40ab49fd69abe9e4e12a6c321ad86c497
 F src/build.c af1296e8a21a406b4f4c4f1e1365e075071219f3
 F src/cursor.c f883813759742068890b1f699335872bfa8fdf41
-F src/date.c 65536e7ea04fdde6e0551264fca15966966e171f
+F src/date.c f3d1f5cd1503dabf426a198f3ebef5afbc122a7f
 F src/delete.c 32277d2834e36c7538c047f14d643751c256c73b
-F src/expr.c ecfc8fd972e73650708e1109f97b1c5a785e0a0e
+F src/expr.c 22bc51e18b2e686f3c831d33b2c38b5a3e6733f9
 F src/func.c dc188d862d7276ea897655b248e2cb17022686e3
 F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
@@ -59,7 +59,7 @@ F src/parse.y ceba179b9703657180963568f54b0e75f33e36e1
 F src/pragma.c ac594f74c90ffec043c43e49358719ffeb491eec
 F src/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357
 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
-F src/select.c af6ffcf0201f8f4e2697eea25689077dc61c6109
+F src/select.c e29c70ec5f5dbb66c6bf8ca3ab3b41cbb8daa41b
 F src/shell.c 591364a0e9ca4ce53873e21e0294476c0c2b4770
 F src/sqlite.h.in 0d5e48e506845b74a845c9470e01d3f472b59611
 F src/sqliteInt.h 641b348a109a080262d9f3603f2e94143d4383f2
@@ -120,7 +120,7 @@ F test/corrupt2.test cb1f813df7559de3021e01170af0bba31507a9a5
 F test/crash.test b87f2c2fe6a05c46c8832bb077e131bb4b507a8d
 F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
 F test/cursor.test d7c65ea0fc4e321e12fbcf5c7f3e2211ef45379b
-F test/date.test dda578ec1857837156bd8b32f8e09d81d7d7881c
+F test/date.test ef6c679d0b59502457dbd78ee1c3c085c949c4c4
 F test/delete.test fc29491f6a7ac899ce29f4549a104809e245d9a6
 F test/delete2.test e382b6a97787197eb8b93dd4ccd37797c3725ea3
 F test/diskfull.test e2f6cfd868713ead06dc82b84a4938e868128fc0
@@ -146,7 +146,7 @@ F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3
 F test/join4.test 8dec387d06b3a4685e1104048065cf5236b99b93
 F test/lastinsert.test b6a1db3e1ce2d3f0d6afe99d445084f543b6feaa
 F test/laststmtchanges.test 07cbdabc52407c29e40abc25050f2434f044a6b1
-F test/limit.test 0225cadf96f199566b6d1ae7b5642492878ec45a
+F test/limit.test f509165de59637fa4725981e2f65eca0e1299a9d
 F test/lock.test a19aab9a963273fe61c1058e3d1b648d6a0a2425
 F test/lock2.test 59c3dd7d9b24d1bf7ec91b2d1541c37e97939d5f
 F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
@@ -175,7 +175,7 @@ F test/reindex.test 3552c6b944a3fab28cfd3049c04c65cb79419757
 F test/rollback.test 94cd981ee3a627d9f6466f69dcf1f7dbfe695d7a
 F test/rowid.test 1ce3f1520d2082b0363e7d9bdef904cb72b9efe8
 F test/safety.test 907b64fee719554a3622853812af3886fddbbb4f
-F test/select1.test 524d4323f3921db16138f8b1765f1cc44e030bf4
+F test/select1.test 2b08187aff4685231aec312e7776a5894eefd9e8
 F test/select2.test 91a2225926039b0d1687840735c284dbbf89f0bc
 F test/select3.test 9de435aa84fc406708cd8dc1b1d60e7f27cea685
 F test/select4.test 1ae6f2bd6177d4428df8644eb95d09f4568fb149
@@ -269,7 +269,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc
 F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
 F www/whentouse.tcl c3b50d3ac31c54be2a1af9b488a89d22f1e6e746
-P 997d8afff9b316aef4c5e2127c2207758ff4a703
-R f72aab18ccb7f1e272e72a0b220a767c
+P 3ef95d5fe98e7451f8b87b3f5259163f3e7d0289
+R 0dac24ab9c449997916f810d80271d4c
 U drh
-Z 1ce583b41471899cabfc5a365dbcd8c6
+Z 1f96a701f8d82044d6c8d59082332ad8
index 0ce6b94295cf25eb3f75f18de65a9e1ec0834c00..3e736c8c5b1ad2676295b02515ec5d393713f182 100644 (file)
@@ -1 +1 @@
-3ef95d5fe98e7451f8b87b3f5259163f3e7d0289
\ No newline at end of file
+92f9d2b2f480fccfa6e8b70a1d19058b92a4ea8f
\ No newline at end of file
index dea047d5b1c72f0683edf492de8a6d8a178fa776..d472e588e40a7227194d870c25e2aefb30b8d74b 100644 (file)
@@ -16,7 +16,7 @@
 ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: date.c,v 1.42 2004/11/14 21:56:30 drh Exp $
+** $Id: date.c,v 1.43 2005/01/15 01:52:32 drh Exp $
 **
 ** NOTES:
 **
@@ -315,12 +315,10 @@ static int parseDateOrTime(const char *zDate, DateTime *p){
     return 0;
   }else if( sqlite3StrICmp(zDate,"now")==0){
     double r;
-    if( sqlite3OsCurrentTime(&r)==0 ){
-      p->rJD = r;
-      p->validJD = 1;
-      return 0;
-    }
-    return 1;
+    sqlite3OsCurrentTime(&r);
+    p->rJD = r;
+    p->validJD = 1;
+    return 0;
   }else if( sqlite3IsNumber(zDate, 0, SQLITE_UTF8) ){
     p->rJD = sqlite3AtoF(zDate, 0);
     p->validJD = 1;
index cc753be27d1146a2683046a5b9df690047559bce..8e125624af92894e7d6e55dd00a8355374f6a7d9 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.177 2005/01/13 02:14:25 danielk1977 Exp $
+** $Id: expr.c,v 1.178 2005/01/15 01:52:32 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -614,16 +614,6 @@ int sqlite3ExprIsInteger(Expr *p, int *pValue){
       }
       break;
     }
-    case TK_STRING: {
-      const u8 *z = (u8*)p->token.z;
-      int n = p->token.n;
-      if( n>0 && z[0]=='-' ){ z++; n--; }
-      while( n>0 && *z && isdigit(*z) ){ z++; n--; }
-      if( n==0 && sqlite3GetInt32(p->token.z, pValue) ){
-        return 1;
-      }
-      break;
-    }
     case TK_UPLUS: {
       return sqlite3ExprIsInteger(p->pLeft, pValue);
     }
index aa0f92008f9963ac57b24eb1a73c9376ddc63b49..ac12ff48ae6e5cdd1783800489677df50591c20e 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle SELECT statements in SQLite.
 **
-** $Id: select.c,v 1.220 2005/01/03 02:26:55 drh Exp $
+** $Id: select.c,v 1.221 2005/01/15 01:52:32 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -670,14 +670,18 @@ static const char *columnType(Parse *pParse, SrcList *pTabList, Expr *pExpr){
       }
       break;
     }
-    case TK_AS:
-      zType = columnType(pParse, pTabList, pExpr->pLeft); 
-      break;
     case TK_SELECT: {
       Select *pS = pExpr->pSelect;
       zType = columnType(pParse, pS->pSrc, pS->pEList->a[0].pExpr); 
       break;
     }
+    case TK_AS:
+      /* The TK_AS operator can only occur in ORDER BY, GROUP BY, HAVING,
+      ** and LIMIT clauses.  But pExpr originates in the result set of a
+      ** SELECT.  So pExpr can never contain an AS operator.
+      */
+      assert( 0 );
+      /* Fall thru */
     default:
       zType = 0;
   }
index a0150a610a51c0de99228cdf02cc826f7e92e835..7cff7a8026635564c78e4e77a14b985bd282a64c 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing date and time functions.
 #
-# $Id: date.test,v 1.11 2004/10/31 02:22:50 drh Exp $
+# $Id: date.test,v 1.12 2005/01/15 01:52:33 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -55,6 +55,8 @@ datetest 1.22 {julianday('2000-01-01 12:00:00.')} NULL
 datetest 1.23 julianday(12345.6) 12345.6
 datetest 1.24 {julianday('2001-01-01 12:00:00 bogus')} NULL
 datetest 1.25 {julianday('2001-01-01 bogus')} NULL
+datetest 1.26 {julianday('2001-01-01 12:60:00')} NULL
+datetest 1.27 {julianday('2001-01-01 12:59:60')} NULL
 
 datetest 2.1 datetime(0,'unixepoch') {1970-01-01 00:00:00}
 datetest 2.2 datetime(946684800,'unixepoch') {2000-01-01 00:00:00}
@@ -140,6 +142,7 @@ datetest 5.1 {datetime('1994-04-16 14:00:00 -05:00')} {1994-04-16 09:00:00}
 datetest 5.2 {datetime('1994-04-16 14:00:00 +05:15')} {1994-04-16 19:15:00}
 datetest 5.3 {datetime('1994-04-16 05:00:00 -08:30')} {1994-04-15 20:30:00}
 datetest 5.4 {datetime('1994-04-16 14:00:00 +11:55')} {1994-04-17 01:55:00}
+datetest 5.5 {datetime('1994-04-16 14:00:00 +11:60')} NULL
 
 # localtime->utc and utc->localtime conversions.  These tests only work
 # if the localtime is in the US Eastern Time (the time in Charlotte, NC
@@ -258,6 +261,7 @@ datetest 11.8 {datetime('2004-02-28 20:00:00', '11:59')} \
    {2004-02-29 07:59:00}
 datetest 11.9 {datetime('2004-02-28 20:00:00', '12:01')} \
    {2004-02-29 08:01:00}
+datetest 11.10 {datetime('2004-02-28 20:00:00', '12:60')} NULL
 
 
 
index 870d15eff3a755878cfe6b2af566e1643ad81a1c..4e2f5f7e119231b526142f6bed35a885c7248e8d 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this file is testing the LIMIT ... OFFSET ... clause
 #  of SELECT statements.
 #
-# $Id: limit.test,v 1.19 2004/12/16 21:09:18 drh Exp $
+# $Id: limit.test,v 1.20 2005/01/15 01:52:33 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -348,5 +348,12 @@ do_test limit-9.4 {
     LIMIT 2
   }
 } {1 2}
+do_test limit-9.5 {
+  catchsql {
+    SELECT * FROM t6 LIMIT 3
+    UNION
+    SELECT * FROM t7 LIMIT 3
+  }
+} {1 {LIMIT clause should come after UNION not before}}
 
 finish_test
index d6bab3f657017731ab1832d3654b94a710e4417b..270dcb3e2d6616d18e5161e62104d1f8ef834db0 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the SELECT statement.
 #
-# $Id: select1.test,v 1.37 2004/11/22 13:35:42 danielk1977 Exp $
+# $Id: select1.test,v 1.38 2005/01/15 01:52:33 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -291,11 +291,26 @@ do_test select1-4.6 {
     SELECT f1 FROM test1 ORDER BY '8.4';
   }
 } {1 {ORDER BY terms must not be non-integer constants}}
-do_test select1-4.7 {
+do_test select1-4.7.1 {
   catchsql {
     SELECT f1 FROM test1 ORDER BY 'xyz';
   }
 } {1 {ORDER BY terms must not be non-integer constants}}
+do_test select1-4.7.2 {
+  catchsql {
+    SELECT f1 FROM test1 ORDER BY -8.4;
+  }
+} {1 {ORDER BY terms must not be non-integer constants}}
+do_test select1-4.7.3 {
+  catchsql {
+    SELECT f1 FROM test1 ORDER BY +8.4;
+  }
+} {1 {ORDER BY terms must not be non-integer constants}}
+do_test select1-4.7.4 {
+  catchsql {
+    SELECT f1 FROM test1 ORDER BY 4294967296; -- constant larger than 32 bits
+  }
+} {1 {ORDER BY terms must not be non-integer constants}}
 do_test select1-4.8 {
   execsql {
     CREATE TABLE t5(a,b);
@@ -304,16 +319,26 @@ do_test select1-4.8 {
     SELECT * FROM t5 ORDER BY 1;
   }
 } {1 10 2 9}
-do_test select1-4.9 {
+do_test select1-4.9.1 {
   execsql {
     SELECT * FROM t5 ORDER BY 2;
   }
 } {2 9 1 10}
-do_test select1-4.10 {
+do_test select1-4.9.2 {
+  execsql {
+    SELECT * FROM t5 ORDER BY +2;
+  }
+} {2 9 1 10}
+do_test select1-4.10.1 {
   catchsql {
     SELECT * FROM t5 ORDER BY 3;
   }
 } {1 {ORDER BY column number 3 out of range - should be between 1 and 2}}
+do_test select1-4.10.2 {
+  catchsql {
+    SELECT * FROM t5 ORDER BY -1;
+  }
+} {1 {ORDER BY column number -1 out of range - should be between 1 and 2}}
 do_test select1-4.11 {
   execsql {
     INSERT INTO t5 VALUES(3,10);