Fossil SCM

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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button