Annotation of embedaddon/sqlite3/test/collateA.test, revision 1.1.1.1
1.1 misho 1: #
2: # 2008 January 20
3: #
4: # The author disclaims copyright to this source code. In place of
5: # a legal notice, here is a blessing:
6: #
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.
10: #
11: #***********************************************************************
12: # This file implements regression tests for SQLite library. The
13: # focus of this script is the built-in RTRIM collating
14: # API.
15: #
16: # $Id: collateA.test,v 1.3 2008/04/15 04:02:41 drh Exp $
17:
18: set testdir [file dirname $argv0]
19: source $testdir/tester.tcl
20:
21: do_test collateA-1.1 {
22: execsql {
23: CREATE TABLE t1(
24: a INTEGER PRIMARY KEY,
25: b TEXT COLLATE BINARY,
26: c TEXT COLLATE RTRIM
27: );
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;
35: }
36: } {6}
37: do_test collateA-1.2 {
38: execsql {SELECT a FROM t1 WHERE b='abcde '}
39: } {}
40: do_test collateA-1.3 {
41: execsql {SELECT a FROM t1 WHERE c='abcde '}
42: } {1}
43: do_test collateA-1.4 {
44: execsql {SELECT a FROM t1 WHERE b='xyzzy'}
45: } {}
46: do_test collateA-1.5 {
47: execsql {SELECT a FROM t1 WHERE c='xyzzy'}
48: } {2 3 4}
49: do_test collateA-1.6 {
50: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
51: } {2 3 4}
52: do_test collateA-1.7 {
53: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
54: } {2 3 4}
55: do_test collateA-1.8 {
56: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
57: } {2 3 4}
58: do_test collateA-1.9 {
59: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
60: } {2 3 4}
61: do_test collateA-1.10 {
62: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
63: } {2 3 4}
64: do_test collateA-1.11 {
65: execsql {SELECT 'abc123'='abc123 ' COLLATE RTRIM;}
66: } {1}
67: do_test collateA-1.12 {
68: execsql {SELECT 'abc123 '='abc123' COLLATE RTRIM;}
69: } {1}
70: do_test collateA-1.13 {
71: execsql {SELECT ' '='' COLLATE RTRIM, ' '='' COLLATE BINARY, ' '=''}
72: } {1 0 0}
73: do_test collateA-1.14 {
74: execsql {SELECT ''=' ' COLLATE RTRIM, ''=' ' COLLATE BINARY, ''=' '}
75: } {1 0 0}
76: do_test collateA-1.15 {
77: execsql {SELECT ' '=' ' COLLATE RTRIM, ' '=' '}
78: } {1 0}
79: do_test collateA-1.16 {
80: execsql {SELECT ''<>' ' COLLATE RTRIM, ''<>' ' COLLATE BINARY, ''<>' '}
81: } {0 1 1}
82: do_test collateA-1.17 {
83: execsql {SELECT a FROM t1 WHERE c='xyzz'}
84: } {}
85: do_test collateA-1.18 {
86: execsql {SELECT a FROM t1 WHERE c='xyzzyy '}
87: } {}
88: do_test collateA-1.19 {
89: execsql {SELECT a FROM t1 WHERE c='xyzz '}
90: } {}
91: do_test collateA-1.20 {
92: execsql {SELECT a FROM t1 WHERE c='abcd '}
93: } {}
94: do_test collateA-1.21 {
95: execsql {SELECT a FROM t1 WHERE c='abcd'}
96: } {}
97: do_test collateA-1.22 {
98: execsql {SELECT a FROM t1 WHERE c='abc'}
99: } {}
100: do_test collateA-1.23 {
101: execsql {SELECT a FROM t1 WHERE c='abcdef '}
102: } {}
103: do_test collateA-1.24 {
104: execsql {SELECT a FROM t1 WHERE c=''}
105: } {5 6}
106: do_test collateA-1.25 {
107: execsql {SELECT a FROM t1 WHERE c=' '}
108: } {5 6}
109: do_test collateA-1.26 {
110: execsql {SELECT a FROM t1 WHERE c=' '}
111: } {5 6}
112:
113:
114: do_test collateA-2.1 {
115: execsql {
116: CREATE INDEX i1b ON t1(b);
117: CREATE INDEX i1c ON t1(c);
118: PRAGMA integrity_check;
119: }
120: } {ok}
121: do_test collateA-2.2 {
122: execsql {SELECT a FROM t1 WHERE b='abcde '}
123: } {}
124: do_test collateA-2.3 {
125: execsql {SELECT a FROM t1 WHERE c='abcde '}
126: } {1}
127: do_test collateA-2.4 {
128: execsql {SELECT a FROM t1 WHERE b='xyzzy'}
129: } {}
130: do_test collateA-2.5 {
131: execsql {SELECT a FROM t1 WHERE c='xyzzy'}
132: } {2 3 4}
133: do_test collateA-2.6 {
134: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
135: } {2 3 4}
136: do_test collateA-2.7 {
137: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
138: } {2 3 4}
139: do_test collateA-2.8 {
140: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
141: } {2 3 4}
142: do_test collateA-2.9 {
143: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
144: } {2 3 4}
145: do_test collateA-2.10 {
146: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
147: } {2 3 4}
148: do_test collateA-2.17 {
149: execsql {SELECT a FROM t1 WHERE c='xyzz'}
150: } {}
151: do_test collateA-2.18 {
152: execsql {SELECT a FROM t1 WHERE c='xyzzyy '}
153: } {}
154: do_test collateA-2.19 {
155: execsql {SELECT a FROM t1 WHERE c='xyzz '}
156: } {}
157: do_test collateA-2.20 {
158: execsql {SELECT a FROM t1 WHERE c='abcd '}
159: } {}
160: do_test collateA-2.21 {
161: execsql {SELECT a FROM t1 WHERE c='abcd'}
162: } {}
163: do_test collateA-2.22 {
164: execsql {SELECT a FROM t1 WHERE c='abc'}
165: } {}
166: do_test collateA-2.23 {
167: execsql {SELECT a FROM t1 WHERE c='abcdef '}
168: } {}
169: do_test collateA-2.24 {
170: execsql {SELECT a FROM t1 WHERE c=''}
171: } {5 6}
172: do_test collateA-2.25 {
173: execsql {SELECT a FROM t1 WHERE c=' '}
174: } {5 6}
175: do_test collateA-2.26 {
176: execsql {SELECT a FROM t1 WHERE c=' '}
177: } {5 6}
178:
179:
180: do_test collateA-3.1 {
181: db close
182: sqlite3 db test.db
183: execsql {
184: REINDEX;
185: PRAGMA integrity_check;
186: }
187: } {ok}
188: do_test collateA-3.2 {
189: execsql {SELECT a FROM t1 WHERE b='abcde '}
190: } {}
191: do_test collateA-3.3 {
192: execsql {SELECT a FROM t1 WHERE c='abcde '}
193: } {1}
194: do_test collateA-3.4 {
195: execsql {SELECT a FROM t1 WHERE b='xyzzy'}
196: } {}
197: do_test collateA-3.5 {
198: execsql {SELECT a FROM t1 WHERE c='xyzzy'}
199: } {2 3 4}
200: do_test collateA-3.6 {
201: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
202: } {2 3 4}
203: do_test collateA-3.7 {
204: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
205: } {2 3 4}
206: do_test collateA-3.8 {
207: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
208: } {2 3 4}
209: do_test collateA-3.9 {
210: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
211: } {2 3 4}
212: do_test collateA-3.10 {
213: execsql {SELECT a FROM t1 WHERE c='xyzzy '}
214: } {2 3 4}
215:
216:
217: finish_test
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>