diff options
author | dan miller | 2007-10-20 02:49:29 +0000 |
---|---|---|
committer | dan miller | 2007-10-20 02:49:29 +0000 |
commit | e36d23a85ebff914d74bb541558c2b6082b78edb (patch) | |
tree | 54b58fdf162e78af64055282a6035c8d2443389d /libraries/sqlite/unix/sqlite-3.5.1/test/icu.test | |
parent | * Fixed an issue whereby avatar chat distances were being calculated against ... (diff) | |
download | opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.zip opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.gz opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.bz2 opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.xz |
sqlite source (unix build) added to libraries
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/test/icu.test')
-rw-r--r-- | libraries/sqlite/unix/sqlite-3.5.1/test/icu.test | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/icu.test b/libraries/sqlite/unix/sqlite-3.5.1/test/icu.test new file mode 100644 index 0000000..2a247c6 --- /dev/null +++ b/libraries/sqlite/unix/sqlite-3.5.1/test/icu.test | |||
@@ -0,0 +1,118 @@ | |||
1 | # 2007 May 1 | ||
2 | # | ||
3 | # The author disclaims copyright to this source code. In place of | ||
4 | # a legal notice, here is a blessing: | ||
5 | # | ||
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. | ||
9 | # | ||
10 | #*********************************************************************** | ||
11 | # | ||
12 | # $Id: icu.test,v 1.1 2007/05/07 11:53:14 danielk1977 Exp $ | ||
13 | # | ||
14 | |||
15 | set testdir [file dirname $argv0] | ||
16 | source $testdir/tester.tcl | ||
17 | |||
18 | ifcapable !icu { | ||
19 | finish_test | ||
20 | return | ||
21 | } | ||
22 | |||
23 | # Create a table to work with. | ||
24 | # | ||
25 | execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)} | ||
26 | execsql {INSERT INTO test1 VALUES(1,2,1.1,2.2,'hello','world')} | ||
27 | proc test_expr {name settings expr result} { | ||
28 | do_test $name [format { | ||
29 | db one { | ||
30 | BEGIN; | ||
31 | UPDATE test1 SET %s; | ||
32 | SELECT %s FROM test1; | ||
33 | ROLLBACK; | ||
34 | } | ||
35 | } $settings $expr] $result | ||
36 | } | ||
37 | |||
38 | # Tests of the REGEXP operator. | ||
39 | # | ||
40 | test_expr icu-1.1 {i1='hello'} {i1 REGEXP 'hello'} 1 | ||
41 | test_expr icu-1.2 {i1='hello'} {i1 REGEXP '.ello'} 1 | ||
42 | test_expr icu-1.3 {i1='hello'} {i1 REGEXP '.ell'} 0 | ||
43 | test_expr icu-1.4 {i1='hello'} {i1 REGEXP '.ell.*'} 1 | ||
44 | test_expr icu-1.5 {i1=NULL} {i1 REGEXP '.ell.*'} {} | ||
45 | |||
46 | # Some non-ascii characters with defined case mappings | ||
47 | # | ||
48 | set ::EGRAVE "\xC8" | ||
49 | set ::egrave "\xE8" | ||
50 | |||
51 | set ::OGRAVE "\xD2" | ||
52 | set ::ograve "\xF2" | ||
53 | |||
54 | # That German letter that looks a bit like a B. The | ||
55 | # upper-case version of which is "SS" (two characters). | ||
56 | # | ||
57 | set ::szlig "\xDF" | ||
58 | |||
59 | # Tests of the upper()/lower() functions. | ||
60 | # | ||
61 | test_expr icu-2.1 {i1='HellO WorlD'} {upper(i1)} {HELLO WORLD} | ||
62 | test_expr icu-2.2 {i1='HellO WorlD'} {lower(i1)} {hello world} | ||
63 | test_expr icu-2.3 {i1=$::egrave} {lower(i1)} $::egrave | ||
64 | test_expr icu-2.4 {i1=$::egrave} {upper(i1)} $::EGRAVE | ||
65 | test_expr icu-2.5 {i1=$::ograve} {lower(i1)} $::ograve | ||
66 | test_expr icu-2.6 {i1=$::ograve} {upper(i1)} $::OGRAVE | ||
67 | test_expr icu-2.3 {i1=$::EGRAVE} {lower(i1)} $::egrave | ||
68 | test_expr icu-2.4 {i1=$::EGRAVE} {upper(i1)} $::EGRAVE | ||
69 | test_expr icu-2.5 {i1=$::OGRAVE} {lower(i1)} $::ograve | ||
70 | test_expr icu-2.6 {i1=$::OGRAVE} {upper(i1)} $::OGRAVE | ||
71 | |||
72 | test_expr icu-2.7 {i1=$::szlig} {upper(i1)} "SS" | ||
73 | test_expr icu-2.8 {i1='SS'} {lower(i1)} "ss" | ||
74 | |||
75 | # In turkish (locale="tr_TR"), the lower case version of I | ||
76 | # is "small dotless i" (code point 0x131 (decimal 305)). | ||
77 | # | ||
78 | set ::small_dotless_i "\u0131" | ||
79 | test_expr icu-3.1 {i1='I'} {lower(i1)} "i" | ||
80 | test_expr icu-3.2 {i1='I'} {lower(i1, 'tr_tr')} $::small_dotless_i | ||
81 | test_expr icu-3.3 {i1='I'} {lower(i1, 'en_AU')} "i" | ||
82 | |||
83 | #-------------------------------------------------------------------- | ||
84 | # Test the collation sequence function. | ||
85 | # | ||
86 | do_test icu-4.1 { | ||
87 | execsql { | ||
88 | CREATE TABLE fruit(name); | ||
89 | INSERT INTO fruit VALUES('plum'); | ||
90 | INSERT INTO fruit VALUES('cherry'); | ||
91 | INSERT INTO fruit VALUES('apricot'); | ||
92 | INSERT INTO fruit VALUES('peach'); | ||
93 | INSERT INTO fruit VALUES('chokecherry'); | ||
94 | INSERT INTO fruit VALUES('yamot'); | ||
95 | } | ||
96 | } {} | ||
97 | do_test icu-4.2 { | ||
98 | execsql { | ||
99 | SELECT icu_load_collation('en_US', 'AmericanEnglish'); | ||
100 | SELECT icu_load_collation('lt_LT', 'Lithuanian'); | ||
101 | } | ||
102 | execsql { | ||
103 | SELECT name FROM fruit ORDER BY name COLLATE AmericanEnglish ASC; | ||
104 | } | ||
105 | } {apricot cherry chokecherry peach plum yamot} | ||
106 | |||
107 | |||
108 | # Test collation using Lithuanian rules. In the Lithuanian | ||
109 | # alphabet, "y" comes right after "i". | ||
110 | # | ||
111 | do_test icu-4.3 { | ||
112 | execsql { | ||
113 | SELECT name FROM fruit ORDER BY name COLLATE Lithuanian ASC; | ||
114 | } | ||
115 | } {apricot cherry chokecherry yamot peach plum} | ||
116 | |||
117 | finish_test | ||
118 | |||