blob: 82d7936eef66cc97df93968b5a212f5630b00153 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#
# Copyright (c) 2006 D. Richard Hipp
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the Simplified BSD License (also
# known as the "2-Clause License" or "FreeBSD License".)
#
# This program is distributed in the hope that it will be useful,
# but without any warranty; without even the implied warranty of
# merchantability or fitness for a particular purpose.
#
# Author contact information:
# drh@hwaci.com
# http://www.hwaci.com/drh/
#
############################################################################
#
# Tests of the delta mechanism.
#
test_setup ""
# Use test script files as the basis for this test.
#
# For each test, copy the file intact to "./t1". Make
# some random changes in "./t2". Then call test-delta on the
# two files to make sure that deltas between these two files
# work properly.
#
set filelist [lsort [glob $testdir/*]]
foreach f $filelist {
if {[file isdir $f]} continue
set base [file root [file tail $f]]
set f1 [read_file $f]
write_file t1 $f1
for {set i 0} {$i<100} {incr i} {
write_file t2 [random_changes $f1 1 1 0 0.1]
fossil test-delta t1 t2
test delta-$base-$i-1 {[normalize_result]=="ok"}
write_file t2 [random_changes $f1 1 1 0 0.2]
fossil test-delta t1 t2
test delta-$base-$i-2 {[normalize_result]=="ok"}
write_file t2 [random_changes $f1 1 1 0 0.4]
fossil test-delta t1 t2
test delta-$base-$i-3 {[normalize_result]=="ok"}
}
}
set empties { "" "" "" a a "" }
set i 0
foreach {f1 f2} $empties {
incr i
write_file t1 $f1
write_file t2 $f2
fossil test-delta t1 t2
test delta-empty-$i {[normalize_result]=="ok"}
}
###############################################################################
test_cleanup
|