summaryrefslogtreecommitdiff
path: root/test/delta1.test
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-09-04 09:05:24 +0200
committercashmere <cashmere@autistici.org>2026-09-04 09:05:24 +0200
commit4f49b16079b27d7ce633619e4cddfdf2bffbc952 (patch)
treec296c1e7f3c3e2f6859c6d3a1b1b208779b89679 /test/delta1.test
downloadrelic-master.tar.gz
initial commitHEADmaster
Diffstat (limited to 'test/delta1.test')
-rw-r--r--test/delta1.test60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/delta1.test b/test/delta1.test
new file mode 100644
index 0000000..82d7936
--- /dev/null
+++ b/test/delta1.test
@@ -0,0 +1,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