Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/ext/session/changesetfuzz1.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / ext / session / changesetfuzz1.test` 83 lines ยท 2204 bytes Raw Blame History 1 # 2018 November 08 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 13 if {![info exists testdir]} { 14 set testdir [file join [file dirname [info script]] .. .. test] 15 } 16 source [file join [file dirname [info script]] session_common.tcl] 17 source $testdir/tester.tcl 18 ifcapable !session {finish_test; return} 19 set testprefix changesetfuzz1 20 21 22 set CF [test_find_binary changesetfuzz] 23 if {$CF==""} { 24 finish_test 25 return 26 } 27 28 proc writefile {zFile data} { 29 set fd [open $zFile w] 30 fconfigure $fd -translation binary 31 puts -nonewline $fd $data 32 close $fd 33 } 34 35 do_execsql_test 1.0 { 36 CREATE TABLE t1(a, b, c, d, PRIMARY KEY(c, d)); 37 CREATE TABLE t2(a INTEGER PRIMARY KEY, b, c); 38 39 INSERT INTO t1 VALUES ('one', 'two', 'three', 'four'), 40 ('five', 'six', 'seven', 'eight'), 41 ('nine', 'ten', 'eleven', 'twelve'); 42 INSERT INTO t2 VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9); 43 } 44 45 set C [changeset_from_sql { 46 INSERT INTO t2 VALUES(10, 11, 12); 47 DELETE FROM t2 WHERE a=1; 48 UPDATE t1 SET b='forty-five' WHERE a='one'; 49 UPDATE t1 SET a='twenty-nine', b='seventy' WHERE a='five'; 50 }] 51 writefile c1.changeset $C 52 53 do_test 1.1 { 54 for {set j 0} {$j < 200} {incr j} { 55 forcecopy c1.changeset input.changeset 56 for {set i 0} {$i < 6} {incr i} { 57 exec $CF input.changeset $i 1 58 exec $CF input.changeset-0 59 forcecopy input.changeset-0 input.changeset 60 } 61 } 62 } {} 63 64 set P [patchset_from_sql { 65 INSERT INTO t2 VALUES(13, 14, 15); 66 DELETE FROM t2 WHERE a=4; 67 UPDATE t1 SET b='thirteen' WHERE a='one'; 68 UPDATE t1 SET a='ninety-seven', b='twenty' WHERE a='five'; 69 }] 70 writefile p1.patchset $P 71 do_test 1.2 { 72 for {set j 0} {$j < 200} {incr j} { 73 forcecopy p1.patchset input.patchset 74 for {set i 0} {$i < 6} {incr i} { 75 exec $CF input.patchset $i 1 76 exec $CF input.patchset-0 77 forcecopy input.patchset-0 input.patchset 78 } 79 } 80 } {} 81 82 83 finish_test