]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Additional encoding tests.
authorshaneh <shaneh@noemail.net>
Thu, 30 Sep 2010 18:19:44 +0000 (18:19 +0000)
committershaneh <shaneh@noemail.net>
Thu, 30 Sep 2010 18:19:44 +0000 (18:19 +0000)
FossilOrigin-Name: c7f9363617a66ee43a87816ad42aaf2b75f13ea2

manifest
manifest.uuid
test/enc4.test [new file with mode: 0644]

index 8e2bfc803b26d7d7ae7fb2f49087f40f32a1bee5..8a21045b641368c934b3c9bf4a3e7da463b540ac 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,5 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Remove\sunnecessary\scalls\sto\smemAboutToChange()\sin\svdbe.c.\s\sAn\saffinity\nchange\sno\slonger\sinvalidates\sshallow\scopies.
-D 2010-09-30T18:12:02
+C Additional\sencoding\stests.
+D 2010-09-30T18:19:44
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -365,6 +362,7 @@ F test/e_vacuum.test 057cc29445746fc1d2542984ff0253d511a234bd
 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
 F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398
 F test/enc3.test 5c550d59ff31dccdba5d1a02ae11c7047d77c041
+F test/enc4.test f77a8172fc789f346f8cfaa201969d9251855ab2
 F test/eval.test bc269c365ba877554948441e91ad5373f9f91be3
 F test/exclusive.test 0ba00fb15aeec1eba3d4b03a271b5081e21c35be
 F test/exclusive2.test 76e63c05349cb70d09d60b99d2ae625525ff5155
@@ -874,14 +872,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P ca154f97a590745539b2cbfd77eb319fd7392a40
-R 748449bce6ae506eaa073ea594abdada
-U drh
-Z 093ac075ab4b1886bb1eccb584418581
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFMpNL1oxKgR168RlERAjjtAJ4+t7sulYFx05+58t1+K8swwMqAWQCfbEoM
-G6/RegdDSppspf4YTh1aD/Y=
-=7FrQ
------END PGP SIGNATURE-----
+P afb0fd0b0421c42630c5e6e5e8811aca634bc9d0
+R cd06bfdd4d6b826a69cbc7d431c4e132
+U shaneh
+Z 43d49001f03bba36add05ffc6539647c
index e03860e931812fd10786d4fa6816ab1432bee41d..af001fec109a36807a85aa230ab6d4754c9129b7 100644 (file)
@@ -1 +1 @@
-afb0fd0b0421c42630c5e6e5e8811aca634bc9d0
\ No newline at end of file
+c7f9363617a66ee43a87816ad42aaf2b75f13ea2
\ No newline at end of file
diff --git a/test/enc4.test b/test/enc4.test
new file mode 100644 (file)
index 0000000..f8403c3
--- /dev/null
@@ -0,0 +1,124 @@
+# 2010 Sept 29\r
+#\r
+# The author disclaims copyright to this source code.  In place of\r
+# a legal notice, here is a blessing:\r
+#\r
+#    May you do good and not evil.\r
+#    May you find forgiveness for yourself and forgive others.\r
+#    May you share freely, never taking more than you give.\r
+#\r
+#***********************************************************************\r
+# This file implements regression tests for SQLite library.  The focus of\r
+# this file is testing the SQLite routines used for converting between the\r
+# various suported unicode encodings (UTF-8, UTF-16, UTF-16le and\r
+# UTF-16be).\r
+#\r
+# $Id: enc4.test,v 1.0 2010/09/29 08:29:32 shaneh Exp $\r
+\r
+set testdir [file dirname $argv0]\r
+source $testdir/tester.tcl\r
+\r
+# If UTF16 support is disabled, ignore the tests in this file\r
+#\r
+ifcapable {!utf16} {\r
+  finish_test\r
+  return\r
+}\r
+\r
+db close\r
+\r
+# The three unicode encodings understood by SQLite.\r
+set encodings [list UTF-8 UTF-16le UTF-16be]\r
+\r
+# initial value to use in SELECT\r
+set inits [list 1 1.0]\r
+\r
+# vals\r
+set vals [list\\r
+"922337203685477580792233720368547758079223372036854775807"\\r
+"100000000000000000000000000000000000000000000000000000000"\\r
+"1.0000000000000000000000000000000000000000000000000000000"\\r
+]\r
+\r
+set i 1\r
+foreach enc $encodings {\r
+\r
+  file delete -force test.db\r
+  sqlite3 db test.db\r
+  db eval "PRAGMA encoding = \"$enc\""\r
+\r
+  do_test enc4-$i.1 {\r
+    db eval {PRAGMA encoding}\r
+  } $enc\r
+\r
+  set j 1\r
+  foreach init $inits {\r
+\r
+    do_test enc4-$i.$j.2 {\r
+      set S [sqlite3_prepare_v2 db "SELECT $init+?" -1 dummy]\r
+      sqlite3_expired $S\r
+    } {0}\r
+      \r
+    set k 1\r
+    foreach val $vals {\r
+      for {set x 1} {$x<18} {incr x} {\r
+        set part [expr $init + [string range $val 0 [expr $x-1]]]\r
+\r
+        do_test enc4-$i.$j.$k.3.$x {\r
+          sqlite3_reset $S\r
+          sqlite3_bind_text $S 1 $val $x\r
+          sqlite3_step $S\r
+          sqlite3_column_text $S 0\r
+        } [list $part]\r
+        \r
+        do_test enc4-$i.$j.$k.4.$x {\r
+          sqlite3_reset $S\r
+          sqlite3_bind_text16 $S 1 [encoding convertto unicode $val] [expr $x*2]\r
+          sqlite3_step $S\r
+          sqlite3_column_text $S 0\r
+        } [list $part]\r
+      }\r
+      \r
+      incr k\r
+    }\r
+\r
+    do_test enc4-$i.$j.5 {\r
+      sqlite3_finalize $S\r
+    } {SQLITE_OK}\r
+\r
+    incr j\r
+  }\r
+\r
+  db close\r
+  incr i\r
+}\r
+\r
+file delete -force test.db\r
+sqlite3 db test.db\r
+\r
+do_test enc4-4.1 {\r
+  db eval "select 1+1."\r
+} {2.0}\r
+\r
+do_test enc4-4.2 {\r
+  set S [sqlite3_prepare_v2 db "SELECT 1+1." -1 dummy]\r
+  sqlite3_step $S\r
+  sqlite3_column_text $S 0\r
+} {2.0}\r
+\r
+do_test enc4-4.3 {\r
+  set S [sqlite3_prepare_v2 db "SELECT 1+?" -1 dummy]\r
+  sqlite3_bind_text $S 1 "1." 2\r
+  sqlite3_step $S\r
+  sqlite3_column_text $S 0\r
+} {2.0}\r
+\r
+do_test enc4-4.4 {\r
+  set S [sqlite3_prepare_v2 db "SELECT 1+?" -1 dummy]\r
+  sqlite3_bind_text $S 1 "1.0" 2\r
+  sqlite3_step $S\r
+  sqlite3_column_text $S 0\r
+} {2.0}\r
+\r
+\r
+finish_test\r