summaryrefslogtreecommitdiffstats
path: root/ext/rbu/rbu8.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:28:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:28:19 +0000
commit18657a960e125336f704ea058e25c27bd3900dcb (patch)
tree17b438b680ed45a996d7b59951e6aa34023783f2 /ext/rbu/rbu8.test
parentInitial commit. (diff)
downloadsqlite3-18657a960e125336f704ea058e25c27bd3900dcb.tar.xz
sqlite3-18657a960e125336f704ea058e25c27bd3900dcb.zip
Adding upstream version 3.40.1.upstream/3.40.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--ext/rbu/rbu8.test74
1 files changed, 74 insertions, 0 deletions
diff --git a/ext/rbu/rbu8.test b/ext/rbu/rbu8.test
new file mode 100644
index 0000000..c0ccd8c
--- /dev/null
+++ b/ext/rbu/rbu8.test
@@ -0,0 +1,74 @@
+# 2014 November 20
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+# Test the rbu_delta() feature.
+#
+
+if {![info exists testdir]} {
+ set testdir [file join [file dirname [info script]] .. .. test]
+}
+source $testdir/tester.tcl
+set ::testprefix rbu8
+
+do_execsql_test 1.0 {
+ CREATE TABLE t1(x, y PRIMARY KEY, z);
+ INSERT INTO t1 VALUES(NULL, 1, 'one');
+ INSERT INTO t1 VALUES(NULL, 2, 'two');
+ INSERT INTO t1 VALUES(NULL, 3, 'three');
+ CREATE INDEX i1z ON t1(z, x);
+}
+
+do_test 1.1 {
+ forcedelete rbu.db
+ sqlite3 db2 rbu.db
+ db2 eval {
+ CREATE TABLE data_t1(x, y, z, rbu_control);
+ INSERT INTO data_t1 VALUES('a', 1, '_i' , 'x.d');
+ INSERT INTO data_t1 VALUES('b', 2, 2 , '..x');
+ INSERT INTO data_t1 VALUES('_iii', 3, '-III' , 'd.d');
+ }
+ db2 close
+} {}
+
+do_test 1.2.1 {
+ sqlite3rbu rbu test.db rbu.db
+ rbu step
+} {SQLITE_ERROR}
+do_test 1.2.2 {
+ list [catch {rbu close} msg] $msg
+} {1 {SQLITE_ERROR - no such function: rbu_delta}}
+
+proc rbu_delta {orig new} {
+ return "${orig}${new}"
+}
+
+do_test 1.3.1 {
+ while 1 {
+ sqlite3rbu rbu test.db rbu.db
+ rbu create_rbu_delta
+ set rc [rbu step]
+ if {$rc != "SQLITE_OK"} break
+ rbu close
+ }
+ rbu close
+} {SQLITE_DONE}
+
+do_execsql_test 1.3.2 {
+ SELECT * FROM t1
+} {
+ a 1 one_i
+ {} 2 2
+ _iii 3 three-III
+}
+integrity_check 1.3.3
+
+
+finish_test