wasCSharpSQLite – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 # 2005 June 25
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
12 # of this file is testing the interaction of SQLite manifest types
13 # with Tcl dual-representations.
14 #
15 # $Id: types3.test,v 1.8 2008/04/28 13:02:58 drh Exp $
16 #
17  
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
20  
21 # A variable with only a string representation comes in as TEXT
22 do_test types3-1.1 {
23 set V {}
24 append V x
25 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
26 } {string text}
27  
28 # A variable with an integer representation comes in as INTEGER
29 do_test types3-1.2 {
30 set V [expr {int(1+2)}]
31 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
32 } {int integer}
33 set V [expr {1+12345678012345}]
34 if {[tcl_variable_type V]=="wideInt"} {
35 do_test types3-1.3 {
36 set V [expr {1+123456789012345}]
37 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
38 } {wideInt integer}
39 } else {
40 do_test types3-1.3 {
41 set V [expr {1+123456789012345}]
42 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
43 } {int integer}
44 }
45  
46 # A double variable comes in as REAL
47 do_test types3-1.4 {
48 set V [expr {1.0+1}]
49 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
50 } {double real}
51  
52 # A byte-array variable comes in a BLOB if it has no string representation
53 # or as TEXT if there is a string representation.
54 #
55 do_test types3-1.5 {
56 set V [binary format a3 abc]
57 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
58 } {bytearray blob}
59 do_test types3-1.6 {
60 set V "abc"
61 binary scan $V a3 x
62 concat [tcl_variable_type V] [execsql {SELECT typeof(:V)}]
63 } {bytearray text}
64  
65 # Check to make sure return values are of the right types.
66 #
67 ifcapable bloblit {
68 do_test types3-2.1 {
69 set V [db one {SELECT x'616263'}]
70 tcl_variable_type V
71 } bytearray
72 }
73 do_test types3-2.2 {
74 set V [db one {SELECT 123}]
75 tcl_variable_type V
76 } int
77 set Vx [expr {1+wide(123456789123456)}]
78 do_test types3-2.3 {
79 set V [db one {SELECT 1234567890123456}]
80 tcl_variable_type V
81 } [tcl_variable_type Vx]
82 do_test types3-2.4.1 {
83 set V [db one {SELECT 1234567890123456.1}]
84 tcl_variable_type V
85 } double
86 do_test types3-2.4.2 {
87 set V [db one {SELECT 1234567890123.456}]
88 tcl_variable_type V
89 } double
90 do_test types3-2.5 {
91 set V [db one {SELECT '1234567890123456.0'}]
92 tcl_variable_type V
93 } {string}
94 do_test types3-2.6 {
95 set V [db one {SELECT NULL}]
96 tcl_variable_type V
97 } {string}
98  
99 finish_test