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 experimental sqlite3_create_collation_v2()
16 # $Id: collate7.test,v 1.2 2008/07/12 14:52:20 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
22 proc caseless_cmp {zLeft zRight} {
23 string compare -nocase $zLeft $zRight
26 do_test collate7-1.1 {
27 set cmd [list incr ::caseless_del]
28 sqlite3_create_collation_v2 db CASELESS caseless_cmp $cmd
31 do_test collate7-1.2 {
32 sqlite_delete_collation db CASELESS
35 do_test collate7-1.3 {
37 CREATE TABLE abc(a COLLATE CASELESS, b, c);
39 } {1 {no such collation sequence: CASELESS}}
40 do_test collate7-1.4 {
41 sqlite3_create_collation_v2 db CASELESS caseless_cmp {incr ::caseless_del}
46 do_test collate7-2.1 {
47 forcedelete test.db test.db-journal
49 sqlite3_create_collation_v2 db CASELESS caseless_cmp {incr ::caseless_del}
51 PRAGMA encoding='utf-16';
52 CREATE TABLE abc16(a COLLATE CASELESS, b, c);
56 do_test collate7-2.2 {
58 SELECT * FROM abc16 WHERE a < 'abc';
62 do_test collate7-2.3 {
63 sqlite_delete_collation db CASELESS
66 do_test collate7-2.4 {
68 SELECT * FROM abc16 WHERE a < 'abc';
70 } {1 {no such collation sequence: CASELESS}}