Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: third_party/sqlite/src/test/enc4.test

Issue 694353003: Get `gn gen` to succeed on Windows (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: remove GYP_DEFINES code Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/test/enc3.test ('k') | third_party/sqlite/src/test/eqp.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # 2010 Sept 29
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 # This file implements regression tests for SQLite library. The focus of
12 # this file is testing the SQLite routines used for converting between the
13 # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and
14 # UTF-16be).
15 #
16 # $Id: enc4.test,v 1.0 2010/09/29 08:29:32 shaneh Exp $
17
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
20
21 # If UTF16 support is disabled, ignore the tests in this file
22 #
23 ifcapable {!utf16} {
24 finish_test
25 return
26 }
27
28 db close
29
30 # The three unicode encodings understood by SQLite.
31 set encodings [list UTF-8 UTF-16le UTF-16be]
32
33 # initial value to use in SELECT
34 set inits [list 1 1.0 1. 1e0]
35
36 # vals
37 set vals [list\
38 "922337203685477580792233720368547758079223372036854775807"\
39 "100000000000000000000000000000000000000000000000000000000"\
40 "1.0000000000000000000000000000000000000000000000000000000"\
41 ]
42
43 set i 1
44 foreach enc $encodings {
45
46 file delete -force test.db
47 sqlite3 db test.db
48 db eval "PRAGMA encoding = \"$enc\""
49
50 do_test enc4-$i.1 {
51 db eval {PRAGMA encoding}
52 } $enc
53
54 set j 1
55 foreach init $inits {
56
57 do_test enc4-$i.$j.2 {
58 set S [sqlite3_prepare_v2 db "SELECT $init+?" -1 dummy]
59 sqlite3_expired $S
60 } {0}
61
62 set k 1
63 foreach val $vals {
64 for {set x 1} {$x<18} {incr x} {
65 set part [expr $init + [string range $val 0 [expr $x-1]]]
66 regsub {e\+0} $part {e+} part
67 regsub {^1e} $part {1.0e} part
68
69 do_test enc4-$i.$j.$k.3.$x {
70 sqlite3_reset $S
71 sqlite3_bind_text $S 1 $val $x
72 sqlite3_step $S
73 sqlite3_column_text $S 0
74 } [list $part]
75
76 do_test enc4-$i.$j.$k.4.$x {
77 sqlite3_reset $S
78 sqlite3_bind_text16 $S 1 [encoding convertto unicode $val] [expr $x*2]
79 sqlite3_step $S
80 sqlite3_column_text $S 0
81 } [list $part]
82 }
83
84 incr k
85 }
86
87 do_test enc4-$i.$j.5 {
88 sqlite3_finalize $S
89 } {SQLITE_OK}
90
91 incr j
92 }
93
94 db close
95 incr i
96 }
97
98 file delete -force test.db
99 sqlite3 db test.db
100
101 do_test enc4-4.1 {
102 db eval "select 1+1."
103 } {2.0}
104
105 do_test enc4-4.2.1 {
106 set S [sqlite3_prepare_v2 db "SELECT 1+1." -1 dummy]
107 sqlite3_step $S
108 sqlite3_column_text $S 0
109 } {2.0}
110
111 do_test enc4-4.2.2 {
112 sqlite3_finalize $S
113 } {SQLITE_OK}
114
115 do_test enc4-4.3.1 {
116 set S [sqlite3_prepare_v2 db "SELECT 1+?" -1 dummy]
117 sqlite3_bind_text $S 1 "1." 2
118 sqlite3_step $S
119 sqlite3_column_text $S 0
120 } {2.0}
121
122 do_test enc4-4.3.2 {
123 sqlite3_finalize $S
124 } {SQLITE_OK}
125
126 do_test enc4-4.4.1 {
127 set S [sqlite3_prepare_v2 db "SELECT 1+?" -1 dummy]
128 sqlite3_bind_text $S 1 "1.0" 2
129 sqlite3_step $S
130 sqlite3_column_text $S 0
131 } {2.0}
132
133 do_test enc4-4.4.2 {
134 sqlite3_finalize $S
135 } {SQLITE_OK}
136
137 db close
138
139 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/enc3.test ('k') | third_party/sqlite/src/test/eqp.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698