dbda8d6ce9 2007-07-21 drh: # dbda8d6ce9 2007-07-21 drh: # Copyright (c) 2006 D. Richard Hipp dbda8d6ce9 2007-07-21 drh: # dbda8d6ce9 2007-07-21 drh: # This program is free software; you can redistribute it and/or dbda8d6ce9 2007-07-21 drh: # modify it under the terms of the GNU General Public dbda8d6ce9 2007-07-21 drh: # License version 2 as published by the Free Software Foundation. dbda8d6ce9 2007-07-21 drh: # dbda8d6ce9 2007-07-21 drh: # This program is distributed in the hope that it will be useful, dbda8d6ce9 2007-07-21 drh: # but WITHOUT ANY WARRANTY; without even the implied warranty of dbda8d6ce9 2007-07-21 drh: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dbda8d6ce9 2007-07-21 drh: # General Public License for more details. dbda8d6ce9 2007-07-21 drh: # dbda8d6ce9 2007-07-21 drh: # You should have received a copy of the GNU General Public dbda8d6ce9 2007-07-21 drh: # License along with this library; if not, write to the dbda8d6ce9 2007-07-21 drh: # Free Software Foundation, Inc., 59 Temple Place - Suite 330, dbda8d6ce9 2007-07-21 drh: # Boston, MA 02111-1307, USA. dbda8d6ce9 2007-07-21 drh: # dbda8d6ce9 2007-07-21 drh: # Author contact information: dbda8d6ce9 2007-07-21 drh: # drh@hwaci.com dbda8d6ce9 2007-07-21 drh: # http://www.hwaci.com/drh/ dbda8d6ce9 2007-07-21 drh: # dbda8d6ce9 2007-07-21 drh: ############################################################################ dbda8d6ce9 2007-07-21 drh: # dbda8d6ce9 2007-07-21 drh: # Tests of the delta mechanism. dbda8d6ce9 2007-07-21 drh: # dbda8d6ce9 2007-07-21 drh: dbda8d6ce9 2007-07-21 drh: # Use test script files as the basis for this test. dbda8d6ce9 2007-07-21 drh: # dbda8d6ce9 2007-07-21 drh: # For each test, copy the file intact to "./t1". Make dbda8d6ce9 2007-07-21 drh: # some random changes in "./t2". Then call test-delta on the dbda8d6ce9 2007-07-21 drh: # two files to make sure that deltas between these two files dbda8d6ce9 2007-07-21 drh: # work properly. dbda8d6ce9 2007-07-21 drh: # dbda8d6ce9 2007-07-21 drh: set filelist [glob $testdir/*] dbda8d6ce9 2007-07-21 drh: foreach f $filelist { dbda8d6ce9 2007-07-21 drh: set base [file root [file tail $f]] dbda8d6ce9 2007-07-21 drh: set f1 [read_file $f] dbda8d6ce9 2007-07-21 drh: write_file t1 $f1 dbda8d6ce9 2007-07-21 drh: for {set i 0} {$i<100} {incr i} { dbda8d6ce9 2007-07-21 drh: write_file t2 [random_changes $f1 1 1 0 0.1] dbda8d6ce9 2007-07-21 drh: fossil test-delta t1 t2 dbda8d6ce9 2007-07-21 drh: test delta-$base-$i-1 {$RESULT=="ok"} dbda8d6ce9 2007-07-21 drh: write_file t2 [random_changes $f1 1 1 0 0.2] dbda8d6ce9 2007-07-21 drh: fossil test-delta t1 t2 dbda8d6ce9 2007-07-21 drh: test delta-$base-$i-2 {$RESULT=="ok"} dbda8d6ce9 2007-07-21 drh: write_file t2 [random_changes $f1 1 1 0 0.4] dbda8d6ce9 2007-07-21 drh: fossil test-delta t1 t2 dbda8d6ce9 2007-07-21 drh: test delta-$base-$i-3 {$RESULT=="ok"} dbda8d6ce9 2007-07-21 drh: } dbda8d6ce9 2007-07-21 drh: }