4 # The author disclaims copyright to this source code. In place of
5 # a legal notice, here is a blessing:
7 # May you do good and not evil.
8 # May you find forgiveness for yourself and forgive others.
9 # May you share freely, never taking more than you give.
11 #***********************************************************************
12 # This file implements regression tests for SQLite library. The
13 # focus of this script is the built-in RTRIM collating
16 # $Id: collateA.test,v 1.3 2008/04/15 04:02:41 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
21 do_test collateA-1.1 {
24 a INTEGER PRIMARY KEY,
25 b TEXT COLLATE BINARY,
28 INSERT INTO t1 VALUES(1, 'abcde','abcde');
29 INSERT INTO t1 VALUES(2, 'xyzzy ','xyzzy ');
30 INSERT INTO t1 VALUES(3, 'xyzzy ','xyzzy ');
31 INSERT INTO t1 VALUES(4, 'xyzzy ','xyzzy ');
32 INSERT INTO t1 VALUES(5, ' ', ' ');
33 INSERT INTO t1 VALUES(6, '', '');
34 SELECT count(*) FROM t1;
37 do_test collateA-1.2 {
38 execsql {SELECT a FROM t1 WHERE b='abcde '}
40 do_test collateA-1.3 {
41 execsql {SELECT a FROM t1 WHERE c='abcde '}
43 do_test collateA-1.4 {
44 execsql {SELECT a FROM t1 WHERE b='xyzzy'}
46 do_test collateA-1.5 {
47 execsql {SELECT a FROM t1 WHERE c='xyzzy'}
49 do_test collateA-1.6 {
50 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
52 do_test collateA-1.7 {
53 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
55 do_test collateA-1.8 {
56 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
58 do_test collateA-1.9 {
59 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
61 do_test collateA-1.10 {
62 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
64 do_test collateA-1.11 {
65 execsql {SELECT 'abc123'='abc123 ' COLLATE RTRIM;}
67 do_test collateA-1.12 {
68 execsql {SELECT 'abc123 '='abc123' COLLATE RTRIM;}
70 do_test collateA-1.13 {
71 execsql {SELECT ' '='' COLLATE RTRIM, ' '='' COLLATE BINARY, ' '=''}
73 do_test collateA-1.14 {
74 execsql {SELECT ''=' ' COLLATE RTRIM, ''=' ' COLLATE BINARY, ''=' '}
76 do_test collateA-1.15 {
77 execsql {SELECT ' '=' ' COLLATE RTRIM, ' '=' '}
79 do_test collateA-1.16 {
80 execsql {SELECT ''<>' ' COLLATE RTRIM, ''<>' ' COLLATE BINARY, ''<>' '}
82 do_test collateA-1.17 {
83 execsql {SELECT a FROM t1 WHERE c='xyzz'}
85 do_test collateA-1.18 {
86 execsql {SELECT a FROM t1 WHERE c='xyzzyy '}
88 do_test collateA-1.19 {
89 execsql {SELECT a FROM t1 WHERE c='xyzz '}
91 do_test collateA-1.20 {
92 execsql {SELECT a FROM t1 WHERE c='abcd '}
94 do_test collateA-1.21 {
95 execsql {SELECT a FROM t1 WHERE c='abcd'}
97 do_test collateA-1.22 {
98 execsql {SELECT a FROM t1 WHERE c='abc'}
100 do_test collateA-1.23 {
101 execsql {SELECT a FROM t1 WHERE c='abcdef '}
103 do_test collateA-1.24 {
104 execsql {SELECT a FROM t1 WHERE c=''}
106 do_test collateA-1.25 {
107 execsql {SELECT a FROM t1 WHERE c=' '}
109 do_test collateA-1.26 {
110 execsql {SELECT a FROM t1 WHERE c=' '}
114 do_test collateA-2.1 {
116 CREATE INDEX i1b ON t1(b);
117 CREATE INDEX i1c ON t1(c);
118 PRAGMA integrity_check;
121 do_test collateA-2.2 {
122 execsql {SELECT a FROM t1 WHERE b='abcde '}
124 do_test collateA-2.3 {
125 execsql {SELECT a FROM t1 WHERE c='abcde '}
127 do_test collateA-2.4 {
128 execsql {SELECT a FROM t1 WHERE b='xyzzy'}
130 do_test collateA-2.5 {
131 execsql {SELECT a FROM t1 WHERE c='xyzzy'}
133 do_test collateA-2.6 {
134 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
136 do_test collateA-2.7 {
137 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
139 do_test collateA-2.8 {
140 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
142 do_test collateA-2.9 {
143 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
145 do_test collateA-2.10 {
146 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
148 do_test collateA-2.17 {
149 execsql {SELECT a FROM t1 WHERE c='xyzz'}
151 do_test collateA-2.18 {
152 execsql {SELECT a FROM t1 WHERE c='xyzzyy '}
154 do_test collateA-2.19 {
155 execsql {SELECT a FROM t1 WHERE c='xyzz '}
157 do_test collateA-2.20 {
158 execsql {SELECT a FROM t1 WHERE c='abcd '}
160 do_test collateA-2.21 {
161 execsql {SELECT a FROM t1 WHERE c='abcd'}
163 do_test collateA-2.22 {
164 execsql {SELECT a FROM t1 WHERE c='abc'}
166 do_test collateA-2.23 {
167 execsql {SELECT a FROM t1 WHERE c='abcdef '}
169 do_test collateA-2.24 {
170 execsql {SELECT a FROM t1 WHERE c=''}
172 do_test collateA-2.25 {
173 execsql {SELECT a FROM t1 WHERE c=' '}
175 do_test collateA-2.26 {
176 execsql {SELECT a FROM t1 WHERE c=' '}
180 do_test collateA-3.1 {
185 PRAGMA integrity_check;
188 do_test collateA-3.2 {
189 execsql {SELECT a FROM t1 WHERE b='abcde '}
191 do_test collateA-3.3 {
192 execsql {SELECT a FROM t1 WHERE c='abcde '}
194 do_test collateA-3.4 {
195 execsql {SELECT a FROM t1 WHERE b='xyzzy'}
197 do_test collateA-3.5 {
198 execsql {SELECT a FROM t1 WHERE c='xyzzy'}
200 do_test collateA-3.6 {
201 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
203 do_test collateA-3.7 {
204 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
206 do_test collateA-3.8 {
207 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
209 do_test collateA-3.9 {
210 execsql {SELECT a FROM t1 WHERE c='xyzzy '}
212 do_test collateA-3.10 {
213 execsql {SELECT a FROM t1 WHERE c='xyzzy '}