interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / test / shortread1.test

52 lines · 1311 bytes Raw Blame History
1# 2007 Sep 13
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
6# May you do good and not evil.
7# May you find forgiveness for yourself and forgive others.
8# May you share freely, never taking more than you give.
9#
10#***********************************************************************
11#
12# This file attempts to duplicate an error scenario seen on a
13# customer system using version 3.2.2. The problem appears to
14# have been fixed (perhaps by accident) with check-in [3503].
15# These tests will prevent an accidental recurrance.
16#
17# $Id: shortread1.test,v 1.1 2007/09/14 01:48:12 drh Exp $
18#
19
20set testdir [file dirname $argv0]
21source $testdir/tester.tcl
22
23do_test shortread1-1.1 {
24 execsql {
25 CREATE TABLE t1(a TEXT);
26 BEGIN;
27 INSERT INTO t1 VALUES(hex(randomblob(5000)));
28 INSERT INTO t1 VALUES(hex(randomblob(100)));
29 PRAGMA freelist_count;
30 }
31} {0}
32do_test shortread1-1.2 {
33 execsql {
34 DELETE FROM t1 WHERE rowid=1;
35 PRAGMA freelist_count;
36 }
37} {11}
38do_test shortread1-1.3 {
39 sqlite3_release_memory [expr {1024*9}]
40 execsql {
41 INSERT INTO t1 VALUES(hex(randomblob(5000)));
42 PRAGMA freelist_count;
43 }
44} {0}
45do_test shortread1-1.4 {
46 execsql {
47 COMMIT;
48 SELECT count(*) FROM t1;
49 }
50} {2}
51
52finish_test