OLD | NEW |
(Empty) | |
| 1 # 2011 March 25 |
| 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 # This file implements regression tests for the session module. |
| 12 # |
| 13 |
| 14 if {![info exists testdir]} { |
| 15 set testdir [file join [file dirname [info script]] .. .. test] |
| 16 } |
| 17 source [file join [file dirname [info script]] session_common.tcl] |
| 18 source $testdir/tester.tcl |
| 19 ifcapable !session {finish_test; return} |
| 20 |
| 21 set testprefix session4 |
| 22 |
| 23 do_test 1.0 { |
| 24 execsql { |
| 25 CREATE TABLE x(a, b, c, d, e, PRIMARY KEY(c, e)); |
| 26 INSERT INTO x VALUES(65.21, X'28B0', 16.35, NULL, 'doers'); |
| 27 INSERT INTO x VALUES(NULL, 78.49, 2, X'60', -66); |
| 28 INSERT INTO x VALUES('cathedral', NULL, 35, NULL, X'B220937E80A2D8'); |
| 29 INSERT INTO x VALUES(NULL, 'masking', -91.37, NULL, X'596D'); |
| 30 INSERT INTO x VALUES(19, 'domains', 'espouse', -94, 'throw'); |
| 31 } |
| 32 |
| 33 set changeset [changeset_from_sql { |
| 34 DELETE FROM x WHERE e = -66; |
| 35 UPDATE x SET a = 'parameterizable', b = 31.8 WHERE c = 35; |
| 36 INSERT INTO x VALUES(-75.61, -17, 16.85, NULL, X'D73DB02678'); |
| 37 }] |
| 38 set {} {} |
| 39 } {} |
| 40 |
| 41 |
| 42 # This currently causes crashes. sqlite3changeset_invert() does not handle |
| 43 # corrupt changesets well. |
| 44 if 0 { |
| 45 do_test 1.1 { |
| 46 for {set i 0} {$i < [string length $changeset]} {incr i} { |
| 47 set before [string range $changeset 0 [expr $i-1]] |
| 48 set after [string range $changeset [expr $i+1] end] |
| 49 for {set j 10} {$j < 260} {incr j} { |
| 50 set x [binary format "a*ca*" $before $j $after] |
| 51 catch { sqlite3changeset_invert $x } |
| 52 } |
| 53 } |
| 54 } {} |
| 55 } |
| 56 |
| 57 do_test 1.2 { |
| 58 set x [binary format "ca*" 0 [string range $changeset 1 end]] |
| 59 list [catch { sqlite3changeset_invert $x } msg] $msg |
| 60 } {1 SQLITE_CORRUPT} |
| 61 |
| 62 do_test 1.3 { |
| 63 set x [binary format "ca*" 0 [string range $changeset 1 end]] |
| 64 list [catch { sqlite3changeset_apply db $x xConflict } msg] $msg |
| 65 } {1 SQLITE_CORRUPT} |
| 66 |
| 67 finish_test |
OLD | NEW |