/ Check-in [0b6cd5ac]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More test coverage enhancements. (CVS 2600)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0b6cd5acc0ede3367623f40ccfaa96116e686824
User & Date: drh 2005-08-19 01:07:16
Context
2005-08-19
02:26
Increased test coverage on trigger.c and printf.c. (CVS 2601) check-in: 842a80bd user: drh tags: trunk
01:07
More test coverage enhancements. (CVS 2600) check-in: 0b6cd5ac user: drh tags: trunk
00:14
Bring testing coverage of the analyze.c file up to 100%. Bugs found and fixed in the process. (CVS 2599) check-in: 2fe0ac4f user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbe.h.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
*************************************************************************
** Header file for the Virtual DataBase Engine (VDBE)
**
** This header defines the interface to the virtual database engine
** or VDBE.  The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
** $Id: vdbe.h,v 1.96 2005/08/12 22:56:09 drh Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
#include <stdio.h>

/*
** A single VDBE is an opaque structure named "Vdbe".  Only routines
................................................................................
void sqlite3VdbeCreateCallback(Vdbe*, int*);
int sqlite3VdbeAddOp(Vdbe*,int,int,int);
int sqlite3VdbeOp3(Vdbe*,int,int,int,const char *zP3,int);
int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
void sqlite3VdbeChangeP3(Vdbe*, int addr, const char *zP1, int N);
int sqlite3VdbeFindOp(Vdbe*, int, int, int);
VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);
int sqlite3VdbeMakeLabel(Vdbe*);
void sqlite3VdbeDelete(Vdbe*);
void sqlite3VdbeMakeReady(Vdbe*,int,int,int,int,int);
int sqlite3VdbeFinalize(Vdbe*);
void sqlite3VdbeResolveLabel(Vdbe*, int);
int sqlite3VdbeCurrentAddr(Vdbe*);







|







 







<







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
101
102
103
104
105
106
107

108
109
110
111
112
113
114
*************************************************************************
** Header file for the Virtual DataBase Engine (VDBE)
**
** This header defines the interface to the virtual database engine
** or VDBE.  The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
** $Id: vdbe.h,v 1.97 2005/08/19 01:07:16 drh Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
#include <stdio.h>

/*
** A single VDBE is an opaque structure named "Vdbe".  Only routines
................................................................................
void sqlite3VdbeCreateCallback(Vdbe*, int*);
int sqlite3VdbeAddOp(Vdbe*,int,int,int);
int sqlite3VdbeOp3(Vdbe*,int,int,int,const char *zP3,int);
int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
void sqlite3VdbeChangeP3(Vdbe*, int addr, const char *zP1, int N);

VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);
int sqlite3VdbeMakeLabel(Vdbe*);
void sqlite3VdbeDelete(Vdbe*);
void sqlite3VdbeMakeReady(Vdbe*,int,int,int,int,int);
int sqlite3VdbeFinalize(Vdbe*);
void sqlite3VdbeResolveLabel(Vdbe*, int);
int sqlite3VdbeCurrentAddr(Vdbe*);

Changes to src/vdbeaux.c.

439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
  assert( p->aOp==0 || p->aOp[p->nOp-1].p3==0 );
  va_start(ap, zFormat);
  sqlite3VdbeChangeP3(p, -1, sqlite3VMPrintf(zFormat, ap), P3_DYNAMIC);
  va_end(ap);
}
#endif

/*
** Search the current program starting at instruction addr for the given
** opcode and P2 value.  Return the address plus 1 if found and 0 if not
** found.
*/
int sqlite3VdbeFindOp(Vdbe *p, int addr, int op, int p2){
  int i;
  assert( p->magic==VDBE_MAGIC_INIT );
  for(i=addr; i<p->nOp; i++){
    if( p->aOp[i].opcode==op && p->aOp[i].p2==p2 ) return i+1;
  }
  return 0;
}

/*
** Return the opcode for a given address.
*/
VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
  assert( p->magic==VDBE_MAGIC_INIT );
  assert( addr>=0 && addr<p->nOp );
  return &p->aOp[addr];







<
<
<
<
<
<
<
<
<
<
<
<
<
<







439
440
441
442
443
444
445














446
447
448
449
450
451
452
  assert( p->aOp==0 || p->aOp[p->nOp-1].p3==0 );
  va_start(ap, zFormat);
  sqlite3VdbeChangeP3(p, -1, sqlite3VMPrintf(zFormat, ap), P3_DYNAMIC);
  va_end(ap);
}
#endif















/*
** Return the opcode for a given address.
*/
VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
  assert( p->magic==VDBE_MAGIC_INIT );
  assert( addr>=0 && addr<p->nOp );
  return &p->aOp[addr];

Added test/default.test.

























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 2005 August 18
#
# 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 corner cases of the DEFAULT syntax
# on table definitions.
#
# $Id: default.test,v 1.1 2005/08/19 01:07:16 drh Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable bloblit {
  do_test default-1.1 {
    execsql {
      CREATE TABLE t1(
        a INTEGER,
        b BLOB DEFAULT x'6869'
      );
      INSERT INTO t1(a) VALUES(1);
      SELECT * from t1;
    }
  } {1 hi}
}
do_test default-1.2 {
  execsql {
    CREATE TABLE t2(
      x INTEGER,
      y INTEGER DEFAULT NULL
    );
    INSERT INTO t2(x) VALUES(1);
    SELECT * FROM t2;
  }
} {1 {}}

finish_test

Changes to test/malloc.test.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#***********************************************************************
# This file attempts to check the library in an out-of-memory situation.
# When compiled with -DSQLITE_DEBUG=1, the SQLite library accepts a special
# command (sqlite_malloc_fail N) which causes the N-th malloc to fail.  This
# special feature is used to see what happens in the library if a malloc
# were to really fail due to an out-of-memory situation.
#
# $Id: malloc.test,v 1.22 2005/01/22 03:39:39 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Only run these tests if memory debugging is turned on.
#
if {[info command sqlite_malloc_stat]==""} {
................................................................................
# Ensure that no file descriptors were leaked.
do_test malloc-1.X {
  catch {db close}
  set sqlite_open_file_count
} {0}

do_malloc_test 2 -sqlbody {
  CREATE TABLE t1(a int, b int, c int);
  CREATE INDEX i1 ON t1(a,b);
  INSERT INTO t1 VALUES(1,1,'99 abcdefghijklmnopqrstuvwxyz');
  INSERT INTO t1 VALUES(2,4,'98 abcdefghijklmnopqrstuvwxyz');
  INSERT INTO t1 VALUES(3,9,'97 abcdefghijklmnopqrstuvwxyz');
  INSERT INTO t1 VALUES(4,16,'96 abcdefghijklmnopqrstuvwxyz');
  INSERT INTO t1 VALUES(5,25,'95 abcdefghijklmnopqrstuvwxyz');
  INSERT INTO t1 VALUES(6,36,'94 abcdefghijklmnopqrstuvwxyz');







|







 







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#***********************************************************************
# This file attempts to check the library in an out-of-memory situation.
# When compiled with -DSQLITE_DEBUG=1, the SQLite library accepts a special
# command (sqlite_malloc_fail N) which causes the N-th malloc to fail.  This
# special feature is used to see what happens in the library if a malloc
# were to really fail due to an out-of-memory situation.
#
# $Id: malloc.test,v 1.23 2005/08/19 01:07:16 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Only run these tests if memory debugging is turned on.
#
if {[info command sqlite_malloc_stat]==""} {
................................................................................
# Ensure that no file descriptors were leaked.
do_test malloc-1.X {
  catch {db close}
  set sqlite_open_file_count
} {0}

do_malloc_test 2 -sqlbody {
  CREATE TABLE t1(a int, b int default 'abc', c int default 1);
  CREATE INDEX i1 ON t1(a,b);
  INSERT INTO t1 VALUES(1,1,'99 abcdefghijklmnopqrstuvwxyz');
  INSERT INTO t1 VALUES(2,4,'98 abcdefghijklmnopqrstuvwxyz');
  INSERT INTO t1 VALUES(3,9,'97 abcdefghijklmnopqrstuvwxyz');
  INSERT INTO t1 VALUES(4,16,'96 abcdefghijklmnopqrstuvwxyz');
  INSERT INTO t1 VALUES(5,25,'95 abcdefghijklmnopqrstuvwxyz');
  INSERT INTO t1 VALUES(6,36,'94 abcdefghijklmnopqrstuvwxyz');