# 2019 June 8 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix window9 ifcapable !windowfunc { finish_test return } do_execsql_test 1.0 { CREATE TABLE fruits( name TEXT COLLATE NOCASE, color TEXT COLLATE NOCASE ); } do_execsql_test 1.1 { INSERT INTO fruits (name, color) VALUES ('apple', 'RED'); INSERT INTO fruits (name, color) VALUES ('APPLE', 'yellow'); INSERT INTO fruits (name, color) VALUES ('pear', 'YELLOW'); INSERT INTO fruits (name, color) VALUES ('PEAR', 'green'); } do_execsql_test 1.2 { SELECT name, color, dense_rank() OVER (ORDER BY name) FROM fruits; } { apple RED 1 APPLE yellow 1 pear YELLOW 2 PEAR green 2 } do_execsql_test 1.3 { SELECT name, color, dense_rank() OVER (PARTITION BY name ORDER BY color) FROM fruits; } { apple RED 1 APPLE yellow 2 PEAR green 1 pear YELLOW 2 } do_execsql_test 1.4 { SELECT name, color, dense_rank() OVER (ORDER BY name), dense_rank() OVER (PARTITION BY name ORDER BY color) FROM fruits; } { apple RED 1 1 APPLE yellow 1 2 PEAR green 2 1 pear YELLOW 2 2 } do_execsql_test 1.5 { SELECT name, color, dense_rank() OVER (ORDER BY name), dense_rank() OVER (PARTITION BY name ORDER BY color) FROM fruits ORDER BY color; } { PEAR green 2 1 apple RED 1 1 APPLE yellow 1 2 pear YELLOW 2 2 } do_execsql_test 2.0 { CREATE TABLE t1(a BLOB, b INTEGER, c COLLATE nocase); INSERT INTO t1 VALUES(1, 2, 'abc'); INSERT INTO t1 VALUES(3, 4, 'ABC'); } do_execsql_test 2.1.1 { SELECT c=='Abc' FROM t1 } {1 1} do_execsql_test 2.1.2 { SELECT c=='Abc', rank() OVER (ORDER BY b) FROM t1 } {1 1 1 2} do_execsql_test 2.2.1 { SELECT b=='2' FROM t1 } {1 0} do_execsql_test 2.2.2 { SELECT b=='2', rank() OVER (ORDER BY a) FROM t1 } {1 1 0 2} finish_test