Update test file walprotocol.test to account for the changes in the wal
[sqlite.git] / ext / lsm1 / test / lsm1_simple.test
blobbc0cb4c6605bda9453bba8fa3d463af7a0f81271
1 # 2017 July 14
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
6 #    May you do good and not evil.
7 #    May you find forgiveness for yourself and forgive others.
8 #    May you share freely, never taking more than you give.
10 #*************************************************************************
11 # This file implements regression tests for SQLite library.  The
12 # focus of this script is testing the lsm1 virtual table module.
15 source [file join [file dirname [info script]] lsm1_common.tcl]
16 set testprefix lsm1_simple
17 return_if_no_lsm1
18 load_lsm1_vtab db
20 forcedelete testlsm.db
22 do_execsql_test 100 {
23   CREATE VIRTUAL TABLE x1 USING lsm1(testlsm.db,a,UINT,b,c,d);
24   PRAGMA table_info(x1);
25 } {
26   0 a UINT 1 {} 1 
27   1 b {} 0 {} 0 
28   2 c {} 0 {} 0 
29   3 d {} 0 {} 0
32 do_execsql_test 110 {
33   INSERT INTO x1(a,b,c,d) VALUES(15, 11, 22, 33),(8,'banjo',x'333231',NULL),
34       (12,NULL,3.25,-559281390);
35   SELECT a, quote(b), quote(c), quote(d) FROM x1;
36 } {8 'banjo' X'333231' NULL 12 NULL 3.25 -559281390 15 11 22 33}
37 do_execsql_test 111 {
38   SELECT a, quote(lsm1_key), quote(lsm1_value) FROM x1;
39 } {8 X'08' X'2162616E6A6F1633323105' 12 X'0C' X'05320000000000000A401FFB42ABE9DB' 15 X'0F' X'4284C6'}
41 do_execsql_test 120 {
42   UPDATE x1 SET d = d+1.0 WHERE a=15;
43   SELECT a, quote(b), quote(c), quote(d) FROM x1;
44 } {8 'banjo' X'333231' NULL 12 NULL 3.25 -559281390 15 11 22 34.0}
46 do_execsql_test 130 {
47   UPDATE x1 SET a=123456789 WHERE a=12;
48   SELECT a, quote(b), quote(c), quote(d) FROM x1;
49 } {8 'banjo' X'333231' NULL 15 11 22 34.0 123456789 NULL 3.25 -559281390}
50 do_execsql_test 131 {
51   SELECT quote(lsm1_key), printf('0x%x',a) FROM x1 WHERE a > 100000000;
52 } {X'FB075BCD15' 0x75bcd15}
54 do_execsql_test 140 {
55   DELETE FROM x1 WHERE a=15;
56   SELECT a, quote(b), quote(c), quote(d) FROM x1;
57 } {8 'banjo' X'333231' NULL 123456789 NULL 3.25 -559281390}
59 do_test 150 {
60   lsort [glob testlsm.db*]
61 } {testlsm.db testlsm.db-log testlsm.db-shm}
63 db close
64 do_test 160 {
65   lsort [glob testlsm.db*]
66 } {testlsm.db}
68 forcedelete testlsm.db
69 forcedelete test.db
70 sqlite3 db test.db
71 load_lsm1_vtab db
74 do_execsql_test 200 {
75   CREATE VIRTUAL TABLE x1 USING lsm1(testlsm.db,a,TEXT,b,c,d);
76   PRAGMA table_info(x1);
77 } {
78   0 a TEXT 1 {} 1 
79   1 b {} 0 {} 0 
80   2 c {} 0 {} 0 
81   3 d {} 0 {} 0
83 do_execsql_test 210 {
84   INSERT INTO x1(a,b,c,d) VALUES(15, 11, 22, 33),(8,'banjo',x'333231',NULL),
85       (12,NULL,3.25,-559281390);
86   SELECT quote(a), quote(b), quote(c), quote(d), '|' FROM x1;
87 } {'12' NULL 3.25 -559281390 | '15' 11 22 33 | '8' 'banjo' X'333231' NULL |}
88 do_execsql_test 211 {
89   SELECT quote(a), quote(lsm1_key), quote(lsm1_value), '|' FROM x1;
90 } {'12' X'3132' X'05320000000000000A401FFB42ABE9DB' | '15' X'3135' X'4284C6' | '8' X'38' X'2162616E6A6F1633323105' |}
93 finish_test