SQLite

Check-in [25f49acc56]
Login

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

Overview
Comment:Test coverage improvements. (CVS 3807)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 25f49acc5662ed8dd321b83a60aeeab93a37e129
User & Date: drh 2007-04-04 01:27:44.000
Context
2007-04-05
05:46
Zero cached pages located beyond the end of the file before returning them. Ticket #2285. (CVS 3808) (check-in: 5180810eea user: danielk1977 tags: trunk)
2007-04-04
01:27
Test coverage improvements. (CVS 3807) (check-in: 25f49acc56 user: drh tags: trunk)
2007-04-03
16:13
Add Tcl (flush) commands to exclusive2.test, which is failing on some systems but not others. (CVS 3806) (check-in: 9e004c519a user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbeaux.c.
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
int sqlite3VdbeCursorMoveto(Cursor *p){
  if( p->deferredMoveto ){
    int res, rc;
#ifdef SQLITE_TEST
    extern int sqlite3_search_count;
#endif
    assert( p->isTable );
    if( p->isTable ){
      rc = sqlite3BtreeMoveto(p->pCursor, 0, p->movetoTarget, 0, &res);
    }else{
      rc = sqlite3BtreeMoveto(p->pCursor,(char*)&p->movetoTarget,
                              sizeof(i64), 0, &res);
    }
    if( rc ) return rc;
    *p->pIncrKey = 0;
    p->lastRowid = keyToInt(p->movetoTarget);
    p->rowidIsValid = res==0;
    if( res<0 ){
      rc = sqlite3BtreeNext(p->pCursor, &res);
      if( rc ) return rc;







<
|
<
<
<
<







1658
1659
1660
1661
1662
1663
1664

1665




1666
1667
1668
1669
1670
1671
1672
int sqlite3VdbeCursorMoveto(Cursor *p){
  if( p->deferredMoveto ){
    int res, rc;
#ifdef SQLITE_TEST
    extern int sqlite3_search_count;
#endif
    assert( p->isTable );

    rc = sqlite3BtreeMoveto(p->pCursor, 0, p->movetoTarget, 0, &res);




    if( rc ) return rc;
    *p->pIncrKey = 0;
    p->lastRowid = keyToInt(p->movetoTarget);
    p->rowidIsValid = res==0;
    if( res<0 ){
      rc = sqlite3BtreeNext(p->pCursor, &res);
      if( rc ) return rc;
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
    return 7;
  }
  if( flags&MEM_Str ){
    int n = pMem->n;
    assert( n>=0 );
    return ((n*2) + 13);
  }
  if( flags&MEM_Blob ){
    return (pMem->n*2 + 12);
  }
  return 0;
}

/*
** Return the length of the data corresponding to the supplied serial-type.
*/
int sqlite3VdbeSerialTypeLen(u32 serial_type){
  if( serial_type>=12 ){







|
|
<
<







1751
1752
1753
1754
1755
1756
1757
1758
1759


1760
1761
1762
1763
1764
1765
1766
    return 7;
  }
  if( flags&MEM_Str ){
    int n = pMem->n;
    assert( n>=0 );
    return ((n*2) + 13);
  }
  assert( (flags & MEM_Blob)!=0 );
  return (pMem->n*2 + 12);


}

/*
** Return the length of the data corresponding to the supplied serial-type.
*/
int sqlite3VdbeSerialTypeLen(u32 serial_type){
  if( serial_type>=12 ){
Changes to test/bindxfer.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2005 April 21
#
# 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 script testing the sqlite_transfer_bindings() API.
#
# $Id: bindxfer.test,v 1.2 2006/01/03 00:33:50 drh Exp $
#

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

proc sqlite_step {stmt VALS COLS} {
  upvar #0 $VALS vals













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2005 April 21
#
# 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 script testing the sqlite_transfer_bindings() API.
#
# $Id: bindxfer.test,v 1.3 2007/04/04 01:27:44 drh Exp $
#

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

proc sqlite_step {stmt VALS COLS} {
  upvar #0 $VALS vals
63
64
65
66
67
68
69

70
71







72

73
} {{} {} {}}
do_test bindxfer-1.7 {
  sqlite_step $VM2 VALUES COLNAMES
} SQLITE_ROW
do_test bindxfer-1.8 {
  set VALUES
} {one two {}}

catch {sqlite3_finalize $VM1}
catch {sqlite3_finalize $VM2}









finish_test







>
|
|
>
>
>
>
>
>
>

>

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
} {{} {} {}}
do_test bindxfer-1.7 {
  sqlite_step $VM2 VALUES COLNAMES
} SQLITE_ROW
do_test bindxfer-1.8 {
  set VALUES
} {one two {}}
do_test bindxfer-1.9 {
  catch {sqlite3_finalize $VM1}
  catch {sqlite3_finalize $VM2}
  sqlite3_transfer_bindings $VM1 $VM2
} 21 ;# SQLITE_MISUSE
do_test bindxfer-1.10 {
  set VM1 [sqlite3_prepare $DB {SELECT ?, ?, ?} -1 TAIL]
  set VM2 [sqlite3_prepare $DB {SELECT ?, ?, ?, ?} -1 TAIL]
  sqlite3_transfer_bindings $VM1 $VM2
} 1  ;# SQLITE_ERROR


finish_test
Changes to test/btree.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2001 September 15
#
# 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 script is btree database backend
#
# $Id: btree.test,v 1.38 2007/01/03 23:37:29 drh Exp $


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

ifcapable default_autovacuum {
  finish_test













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2001 September 15
#
# 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 script is btree database backend
#
# $Id: btree.test,v 1.39 2007/04/04 01:27:44 drh Exp $


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

ifcapable default_autovacuum {
  finish_test
90
91
92
93
94
95
96



97
98
99
100
101
102
103
# Reopen the database and attempt to read the record that we wrote.
#
do_test btree-2.1 {
  set rc [catch {btree_cursor $::b1 1 1} ::c1]
  if {$rc} {lappend rc $::c1}
  set rc
} {0}



do_test btree-2.2 {
  btree_move_to $::c1 99
} {1}
do_test btree-2.3 {
  btree_move_to $::c1 101
} {-1}
do_test btree-2.4 {







>
>
>







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Reopen the database and attempt to read the record that we wrote.
#
do_test btree-2.1 {
  set rc [catch {btree_cursor $::b1 1 1} ::c1]
  if {$rc} {lappend rc $::c1}
  set rc
} {0}
do_test btree-2.1.1 {
  btree_cursor_list $::b1
} {}
do_test btree-2.2 {
  btree_move_to $::c1 99
} {1}
do_test btree-2.3 {
  btree_move_to $::c1 101
} {-1}
do_test btree-2.4 {
Changes to test/shared.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2005 December 30
#
# 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.
#
#***********************************************************************
#
# $Id: shared.test,v 1.21 2006/01/23 21:38:03 drh Exp $

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

ifcapable !shared_cache {
  finish_test











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2005 December 30
#
# 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.
#
#***********************************************************************
#
# $Id: shared.test,v 1.22 2007/04/04 01:27:44 drh Exp $

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

ifcapable !shared_cache {
  finish_test
844
845
846
847
848
849
850



851
852
853
854
855
856
857
858
859
860
    execsql {
      DELETE FROM abc WHERE 1;
    }
    lappend res $I $II
  }
  set res
} {1 4 {} 7}




do_test shared-$av.11.11 {
  db close
  db2 close
} {}

}

sqlite3_enable_shared_cache $::enable_shared_cache
finish_test







>
>
>










844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
    execsql {
      DELETE FROM abc WHERE 1;
    }
    lappend res $I $II
  }
  set res
} {1 4 {} 7}
do_test shared-$av.11.9 {
  sqlite_shared_cache_report 
} [list [file normalize test.db] 2]

do_test shared-$av.11.11 {
  db close
  db2 close
} {}

}

sqlite3_enable_shared_cache $::enable_shared_cache
finish_test