diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-06 22:39:41 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-06 22:39:41 +0000 |
commit | 586381f8db3497c24c11f96234f1879b34e74bc7 (patch) | |
tree | 99f7d18350289b135ef6dd5c161baba8bce668a3 /third_party/sqlite/test/utf16align.test | |
parent | 6e3b12ff2cbbe8c481f986c8f0dd230bb50add2a (diff) | |
download | chromium_src-586381f8db3497c24c11f96234f1879b34e74bc7.zip chromium_src-586381f8db3497c24c11f96234f1879b34e74bc7.tar.gz chromium_src-586381f8db3497c24c11f96234f1879b34e74bc7.tar.bz2 |
Upgrade our sqlite to 3.6.1, with the local changes made by Gears. I'm
checking in the full sqlite tree to make upstream merges easier. This means
we'll have generated sources split out from the originals.
One important change this makes is that "BEGIN" now defaults to "BEGIN
IMMEDIATE" rather than "BEGIN DEFERRED". This doesn't affect us because we
don't use unqualified BEGIN statements.
The full CL is too big for Rietveld. I'm splitting it into 2. This one is
reviewable. The other CL is just a fresh drop of:
//depot/googleclient/gears/opensource/third_party/sqlite_google
Review URL: http://codereview.chromium.org/15067
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7623 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/sqlite/test/utf16align.test')
-rwxr-xr-x | third_party/sqlite/test/utf16align.test | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/third_party/sqlite/test/utf16align.test b/third_party/sqlite/test/utf16align.test new file mode 100755 index 0000000..fb41b77 --- /dev/null +++ b/third_party/sqlite/test/utf16align.test @@ -0,0 +1,84 @@ +# 2006 February 16 +# +# 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 contains code to verify that the SQLITE_UTF16_ALIGNED +# flag passed into the sqlite3_create_collation() function insures +# that all strings passed to that function are aligned on an even +# byte boundary. +# +# $Id: utf16align.test,v 1.1 2006/02/16 18:16:38 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# Skip this entire test if we do not support UTF16 +# +ifcapable !utf16 { + finish_test + return +} + +# Create a database with a UTF16 encoding. Put in lots of string +# data of varying lengths. +# +do_test utf16align-1.0 { + set unaligned_string_counter 0 + add_alignment_test_collations [sqlite3_connection_pointer db] + execsql { + PRAGMA encoding=UTF16; + CREATE TABLE t1( + id INTEGER PRIMARY KEY, + spacer TEXT, + a TEXT COLLATE utf16_aligned, + b TEXT COLLATE utf16_unaligned + ); + INSERT INTO t1(a) VALUES("abc"); + INSERT INTO t1(a) VALUES("defghi"); + INSERT INTO t1(a) VALUES("jklmnopqrstuv"); + INSERT INTO t1(a) VALUES("wxyz0123456789-"); + UPDATE t1 SET b=a||'-'||a; + INSERT INTO t1(a,b) SELECT a||b, b||a FROM t1; + INSERT INTO t1(a,b) SELECT a||b, b||a FROM t1; + INSERT INTO t1(a,b) SELECT a||b, b||a FROM t1; + INSERT INTO t1(a,b) VALUES('one','two'); + INSERT INTO t1(a,b) SELECT a, b FROM t1; + UPDATE t1 SET spacer = CASE WHEN rowid&1 THEN 'x' ELSE 'xx' END; + SELECT count(*) FROM t1; + } +} 66 +do_test utf16align-1.1 { + set unaligned_string_counter +} 0 + +# Creating an index that uses the unaligned collation. We should see +# some unaligned strings passed to the collating function. +# +do_test utf16align-1.2 { + execsql { + CREATE INDEX t1i1 ON t1(spacer, b); + } + # puts $unaligned_string_counter + expr {$unaligned_string_counter>0} +} 1 + +# Create another index that uses the aligned collation. This time +# there should be no unaligned accesses +# +do_test utf16align-1.3 { + set unaligned_string_counter 0 + execsql { + CREATE INDEX t1i2 ON t1(spacer, a); + } + expr {$unaligned_string_counter>0} +} 0 +integrity_check utf16align-1.4 + +finish_test |