ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/bioseg/trunk/expected/bioseg.out
Revision: 1
Committed: Tue Aug 14 22:49:05 2007 UTC (12 years, 2 months ago) by kmr
Original Path: expected/bioseg.out
File size: 7032 byte(s)
Log Message:
Initial bioseg checkin.

Line File contents
1 --
2 -- Test bioseg datatype
3 --
4 --
5 -- first, define the datatype. Turn off echoing so that expected file
6 -- does not depend on contents of bioseg.sql.
7 --
8 SET client_min_messages = warning;
9 \set ECHO none
10 RESET client_min_messages;
11 --
12 -- testing the input and output functions
13 --
14 -- Any number
15 SELECT '1'::bioseg AS bioseg;
16 bioseg
17 --------
18 1
19 (1 row)
20
21 SELECT '99999999'::bioseg AS bioseg;
22 bioseg
23 ----------
24 99999999
25 (1 row)
26
27 -- Finite intervals
28 SELECT '1..2'::bioseg AS bioseg;
29 bioseg
30 --------
31 1..2
32 (1 row)
33
34 SELECT '10000000..20000000'::bioseg AS bioseg;
35 bioseg
36 --------------------
37 10000000..20000000
38 (1 row)
39
40 -- invalid input
41 SELECT ''::bioseg AS bioseg;
42 ERROR: bad bioseg representation
43 DETAIL: end of string found when expecting an integer
44 SELECT '..10'::bioseg AS bioseg;
45 ERROR: bad bioseg representation
46 DETAIL: no integer found at: ..10
47 SELECT '0..10'::bioseg AS bioseg;
48 ERROR: bad bioseg representation
49 DETAIL: integer 0 at: 0..10 is out of range - must be >= 1
50 SELECT '0'::bioseg AS bioseg;
51 ERROR: bad bioseg representation
52 DETAIL: integer 0 at: 0 is out of range - must be >= 1
53 SELECT '-10'::bioseg AS bioseg;
54 ERROR: bad bioseg representation
55 DETAIL: integer -10 at: -10 is out of range - must be >= 1
56 SELECT '-10..-1'::bioseg AS bioseg;
57 ERROR: bad bioseg representation
58 DETAIL: integer -10 at: -10..-1 is out of range - must be >= 1
59 SELECT '-10..0'::bioseg AS bioseg;
60 ERROR: bad bioseg representation
61 DETAIL: integer -10 at: -10..0 is out of range - must be >= 1
62 SELECT '-10..1'::bioseg AS bioseg;
63 ERROR: bad bioseg representation
64 DETAIL: integer -10 at: -10..1 is out of range - must be >= 1
65 SELECT 'ABC'::bioseg AS bioseg;
66 ERROR: bad bioseg representation
67 DETAIL: no integer found at: ABC
68 SELECT '1ABC'::bioseg AS bioseg;
69 ERROR: bad bioseg representation
70 DETAIL: number followed by something other than ..: ABC
71 SELECT '1.'::bioseg AS bioseg;
72 ERROR: bad bioseg representation
73 DETAIL: number followed by something other than ..:
74 SELECT '1.....'::bioseg AS bioseg;
75 ERROR: bad bioseg representation
76 DETAIL: no integer found at: ..
77 SELECT '.1'::bioseg AS bioseg;
78 ERROR: bad bioseg representation
79 DETAIL: no integer found at: .1
80 SELECT '1..2.'::bioseg AS bioseg;
81 ERROR: bad bioseg representation
82 DETAIL: garbage at end of string: .
83 SELECT '1 e7'::bioseg AS bioseg;
84 ERROR: bad bioseg representation
85 DETAIL: number followed by something other than ..: e7
86 SELECT '1e700'::bioseg AS bioseg;
87 ERROR: bad bioseg representation
88 DETAIL: number followed by something other than ..: e700
89 --
90 -- testing the operators
91 --
92 -- equality/inequality:
93 --
94 SELECT '24..33'::bioseg = '24..33'::bioseg AS bool;
95 bool
96 ------
97 t
98 (1 row)
99
100 SELECT '24..50'::bioseg != '24..33'::bioseg AS bool;
101 bool
102 ------
103 t
104 (1 row)
105
106 -- overlap
107 --
108 SELECT '2'::bioseg && '2'::bioseg AS bool;
109 bool
110 ------
111 t
112 (1 row)
113
114 SELECT '2'::bioseg && '2'::bioseg AS bool;
115 bool
116 ------
117 t
118 (1 row)
119
120 SELECT '2..2'::bioseg && '2..2'::bioseg AS bool;
121 bool
122 ------
123 t
124 (1 row)
125
126 SELECT '2..2'::bioseg && '2'::bioseg AS bool;
127 bool
128 ------
129 t
130 (1 row)
131
132 SELECT '2..2'::bioseg && '2'::bioseg AS bool;
133 bool
134 ------
135 t
136 (1 row)
137
138 SELECT '2..2'::bioseg && '2'::bioseg AS bool;
139 bool
140 ------
141 t
142 (1 row)
143
144 SELECT '2'::bioseg && '2..2'::bioseg AS bool;
145 bool
146 ------
147 t
148 (1 row)
149
150 SELECT '2'::bioseg && '2..2'::bioseg AS bool;
151 bool
152 ------
153 t
154 (1 row)
155
156 SELECT '2'::bioseg && '2..3'::bioseg AS bool;
157 bool
158 ------
159 t
160 (1 row)
161
162 -- overlap on the left
163 --
164 SELECT '2'::bioseg &< '2'::bioseg AS bool;
165 bool
166 ------
167 t
168 (1 row)
169
170 SELECT '2'::bioseg &< '3'::bioseg AS bool;
171 bool
172 ------
173 t
174 (1 row)
175
176 SELECT '1..2'::bioseg &< '2'::bioseg AS bool;
177 bool
178 ------
179 t
180 (1 row)
181
182 SELECT '1..2'::bioseg &< '3'::bioseg AS bool;
183 bool
184 ------
185 t
186 (1 row)
187
188 SELECT '1..2'::bioseg &< '1..2'::bioseg AS bool;
189 bool
190 ------
191 t
192 (1 row)
193
194 SELECT '1..2'::bioseg &< '1..3'::bioseg AS bool;
195 bool
196 ------
197 t
198 (1 row)
199
200 SELECT '1..2'::bioseg &< '2..3'::bioseg AS bool;
201 bool
202 ------
203 t
204 (1 row)
205
206 SELECT '1..2'::bioseg &< '3..4'::bioseg AS bool;
207 bool
208 ------
209 t
210 (1 row)
211
212 -- overlap on the right
213 --
214 SELECT '2'::bioseg &> '2'::bioseg AS bool;
215 bool
216 ------
217 t
218 (1 row)
219
220 SELECT '3'::bioseg &> '2'::bioseg AS bool;
221 bool
222 ------
223 t
224 (1 row)
225
226 SELECT '2'::bioseg &> '1..2'::bioseg AS bool;
227 bool
228 ------
229 t
230 (1 row)
231
232 SELECT '3'::bioseg &> '1..2'::bioseg AS bool;
233 bool
234 ------
235 t
236 (1 row)
237
238 SELECT '1..2'::bioseg &> '1..2'::bioseg AS bool;
239 bool
240 ------
241 t
242 (1 row)
243
244 SELECT '1..3'::bioseg &> '1..3'::bioseg AS bool;
245 bool
246 ------
247 t
248 (1 row)
249
250 SELECT '2..3'::bioseg &> '1..2'::bioseg AS bool;
251 bool
252 ------
253 t
254 (1 row)
255
256 SELECT '3..4'::bioseg &> '1..2'::bioseg AS bool;
257 bool
258 ------
259 t
260 (1 row)
261
262 -- left
263 --
264 SELECT '2'::bioseg << '2'::bioseg AS bool;
265 bool
266 ------
267 f
268 (1 row)
269
270 SELECT '2'::bioseg << '3'::bioseg AS bool;
271 bool
272 ------
273 t
274 (1 row)
275
276 SELECT '2..2'::bioseg << '2'::bioseg AS bool;
277 bool
278 ------
279 f
280 (1 row)
281
282 SELECT '2..3'::bioseg << '3'::bioseg AS bool;
283 bool
284 ------
285 f
286 (1 row)
287
288 SELECT '2..3'::bioseg << '3'::bioseg AS bool;
289 bool
290 ------
291 f
292 (1 row)
293
294 SELECT '2..3'::bioseg << '2..3'::bioseg AS bool;
295 bool
296 ------
297 f
298 (1 row)
299
300 SELECT '2..3'::bioseg << '2..4'::bioseg AS bool;
301 bool
302 ------
303 f
304 (1 row)
305
306 SELECT '2..3'::bioseg << '3..4'::bioseg AS bool;
307 bool
308 ------
309 f
310 (1 row)
311
312 SELECT '2..3'::bioseg << '3..5'::bioseg AS bool;
313 bool
314 ------
315 f
316 (1 row)
317
318 -- right
319 --
320 SELECT '2'::bioseg >> '2'::bioseg AS bool;
321 bool
322 ------
323 f
324 (1 row)
325
326 SELECT '3'::bioseg >> '2'::bioseg AS bool;
327 bool
328 ------
329 t
330 (1 row)
331
332 SELECT '2'::bioseg >> '2..2'::bioseg AS bool;
333 bool
334 ------
335 f
336 (1 row)
337
338 SELECT '3'::bioseg >> '2..3'::bioseg AS bool;
339 bool
340 ------
341 f
342 (1 row)
343
344 SELECT '2..3'::bioseg >> '2..3'::bioseg AS bool;
345 bool
346 ------
347 f
348 (1 row)
349
350 SELECT '3..4'::bioseg >> '2..3'::bioseg AS bool;
351 bool
352 ------
353 f
354 (1 row)
355
356 -- "contained in" (the left value belongs within the interval specified in the right value):
357 --
358 SELECT '2'::bioseg <@ '2'::bioseg AS bool;
359 bool
360 ------
361 t
362 (1 row)
363
364 SELECT '2'::bioseg <@ '2..3'::bioseg AS bool;
365 bool
366 ------
367 t
368 (1 row)
369
370 SELECT '3'::bioseg <@ '2..3'::bioseg AS bool;
371 bool
372 ------
373 t
374 (1 row)
375
376 SELECT '3..4'::bioseg <@ '2..5'::bioseg AS bool;
377 bool
378 ------
379 t
380 (1 row)
381
382 SELECT '2..5'::bioseg <@ '2..5'::bioseg AS bool;
383 bool
384 ------
385 t
386 (1 row)
387
388 -- "contains" (the left value contains the interval specified in the right value):
389 --
390 SELECT '2'::bioseg @> '2'::bioseg AS bool;
391 bool
392 ------
393 t
394 (1 row)
395
396 SELECT '2..4'::bioseg <@ '3'::bioseg AS bool;
397 bool
398 ------
399 f
400 (1 row)
401
402 SELECT '3'::bioseg <@ '2..4'::bioseg AS bool;
403 bool
404 ------
405 t
406 (1 row)
407
408 -- Load some example data and build the index
409 --
410 CREATE TABLE test_bioseg (s bioseg);
411 \copy test_bioseg from 'data/test_bioseg.data'
412 CREATE INDEX test_bioseg_ix ON test_bioseg USING gist (s);
413 SELECT count(*) FROM test_bioseg WHERE s @> '11..11';
414 count
415 -------
416 14
417 (1 row)
418
419 -- Test sorting
420 SELECT * FROM test_bioseg WHERE s @> '11..20' GROUP BY s;
421 s
422 ---------
423 4..65
424 5..60
425 6..95
426 6..105
427 7..75
428 7..92
429 7..95
430 9..105
431 10..35
432 10..37
433 10..40
434 10..55
435 10..130
436 (13 rows)
437
438 DROP TABLE test_bioseg;