The first assert() added in [0ebc65481f4a3e79] is not necessarily true in a
[sqlite.git] / test / windowE.test
blobf20bcdaaa844b14f9271444194821ce9b28b6740
1 # 2022 October 18
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 #***********************************************************************
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 set testprefix windowE
17 proc custom {a b} { return [string compare $a $b] }
18 db collate custom custom
20 do_execsql_test 1.0 {
21   CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT COLLATE custom);
22   INSERT INTO t1 VALUES(1, 'one');
23   INSERT INTO t1 VALUES(2, 'two');
24   INSERT INTO t1 VALUES(3, 'three');
25   INSERT INTO t1 VALUES(4, 'four');
26   INSERT INTO t1 VALUES(5, 'five');
27   INSERT INTO t1 VALUES(6, 'six');
28   CREATE INDEX t1b ON t1(b);
31 do_execsql_test 1.1 {
32   SELECT * FROM t1
33 } {
34   1 one 2 two 3 three 4 four 5 five 6 six
37 do_execsql_test 1.2 {
38   SELECT group_concat(a,',') OVER win FROM t1 
39   WINDOW win AS (
40     ORDER BY b RANGE BETWEEN 1 PRECEDING AND 2 PRECEDING
41   )
42 } {
43   5 4 1 6 3 2
46 proc custom {a b} { return [string compare $b $a] }
48 do_execsql_test 1.3 {
49   SELECT group_concat(a,',') OVER win FROM t1 
50   WINDOW win AS (
51     ORDER BY b RANGE BETWEEN 1 PRECEDING AND 2 PRECEDING
52   )
53 } {
54   5 5,4 5,4,1 5,4,1,6 5,4,1,6,3 5,4,1,6,3,2
57 finish_test