CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
collate7.test73 linesDownload Raw Back to test
1#2# 2007 May 73#4# The author disclaims copyright to this source code.  In place of5# 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.  The13# focus of this script is the experimental sqlite3_create_collation_v2()14# API.15#16# $Id: collate7.test,v 1.2 2008/07/12 14:52:20 drh Exp $17 18set testdir [file dirname $argv0]19source $testdir/tester.tcl20 21set ::caseless_del 022proc caseless_cmp {zLeft zRight} {23  string compare -nocase $zLeft $zRight24}25 26do_test collate7-1.1 {27  set cmd [list incr ::caseless_del]28  sqlite3_create_collation_v2 db CASELESS caseless_cmp $cmd29  set ::caseless_del30} {0}31do_test collate7-1.2 {32  sqlite_delete_collation db CASELESS33  set ::caseless_del34} {1}35do_test collate7-1.3 {36  catchsql {37    CREATE TABLE abc(a COLLATE CASELESS, b, c);38  }39} {1 {no such collation sequence: CASELESS}}40do_test collate7-1.4 {41  sqlite3_create_collation_v2 db CASELESS caseless_cmp {incr ::caseless_del}42  db close43  set ::caseless_del44} {2}45 46do_test collate7-2.1 {47  forcedelete test.db test.db-journal48  sqlite3 db test.db49  sqlite3_create_collation_v2 db CASELESS caseless_cmp {incr ::caseless_del}50  execsql {51    PRAGMA encoding='utf-16';52    CREATE TABLE abc16(a COLLATE CASELESS, b, c);53  } db54  set ::caseless_del55} {2}56do_test collate7-2.2 {57  execsql {58    SELECT * FROM abc16 WHERE a < 'abc';59  }60  set ::caseless_del61} {2}62do_test collate7-2.3 {63  sqlite_delete_collation db CASELESS64  set ::caseless_del65} {3}66do_test collate7-2.4 {67  catchsql {68    SELECT * FROM abc16 WHERE a < 'abc';69  }70} {1 {no such collation sequence: CASELESS}}71 72finish_test73