OLD | NEW |
1 # 2001 September 15 | 1 # 2001 September 15 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 test_expr expr-1.38 {i1=1} {-i1} {-1} | 75 test_expr expr-1.38 {i1=1} {-i1} {-1} |
76 test_expr expr-1.39 {i1=1} {+i1} {1} | 76 test_expr expr-1.39 {i1=1} {+i1} {1} |
77 test_expr expr-1.40 {i1=1, i2=2} {+(i2+i1)} {3} | 77 test_expr expr-1.40 {i1=1, i2=2} {+(i2+i1)} {3} |
78 test_expr expr-1.41 {i1=1, i2=2} {-(i2+i1)} {-3} | 78 test_expr expr-1.41 {i1=1, i2=2} {-(i2+i1)} {-3} |
79 test_expr expr-1.42 {i1=1, i2=2} {i1|i2} {3} | 79 test_expr expr-1.42 {i1=1, i2=2} {i1|i2} {3} |
80 test_expr expr-1.42b {i1=1, i2=2} {4|2} {6} | 80 test_expr expr-1.42b {i1=1, i2=2} {4|2} {6} |
81 test_expr expr-1.43 {i1=1, i2=2} {i1&i2} {0} | 81 test_expr expr-1.43 {i1=1, i2=2} {i1&i2} {0} |
82 test_expr expr-1.43b {i1=1, i2=2} {4&5} {4} | 82 test_expr expr-1.43b {i1=1, i2=2} {4&5} {4} |
83 test_expr expr-1.44 {i1=1} {~i1} {-2} | 83 test_expr expr-1.44 {i1=1} {~i1} {-2} |
84 test_expr expr-1.44b {i1=NULL} {~i1} {{}} | 84 test_expr expr-1.44b {i1=NULL} {~i1} {{}} |
85 test_expr expr-1.45 {i1=1, i2=3} {i1<<i2} {8} | 85 test_expr expr-1.45a {i1=1, i2=3} {i1<<i2} {8} |
86 test_expr expr-1.46 {i1=32, i2=3} {i1>>i2} {4} | 86 test_expr expr-1.45b {i1=1, i2=-3} {i1>>i2} {8} |
| 87 test_expr expr-1.45c {i1=1, i2=0} {i1<<i2} {1} |
| 88 test_expr expr-1.45d {i1=1, i2=62} {i1<<i2} {4611686018427387904} |
| 89 test_expr expr-1.45e {i1=1, i2=63} {i1<<i2} {-9223372036854775808} |
| 90 test_expr expr-1.45f {i1=1, i2=64} {i1<<i2} {0} |
| 91 test_expr expr-1.45g {i1=32, i2=-9223372036854775808} {i1>>i2} {0} |
| 92 test_expr expr-1.46a {i1=32, i2=3} {i1>>i2} {4} |
| 93 test_expr expr-1.46b {i1=32, i2=6} {i1>>i2} {0} |
| 94 test_expr expr-1.46c {i1=-32, i2=3} {i1>>i2} {-4} |
| 95 test_expr expr-1.46d {i1=-32, i2=100} {i1>>i2} {-1} |
| 96 test_expr expr-1.46e {i1=32, i2=-3} {i1>>i2} {256} |
87 test_expr expr-1.47 {i1=9999999999, i2=8888888888} {i1<i2} 0 | 97 test_expr expr-1.47 {i1=9999999999, i2=8888888888} {i1<i2} 0 |
88 test_expr expr-1.48 {i1=9999999999, i2=8888888888} {i1=i2} 0 | 98 test_expr expr-1.48 {i1=9999999999, i2=8888888888} {i1=i2} 0 |
89 test_expr expr-1.49 {i1=9999999999, i2=8888888888} {i1>i2} 1 | 99 test_expr expr-1.49 {i1=9999999999, i2=8888888888} {i1>i2} 1 |
90 test_expr expr-1.50 {i1=99999999999, i2=99999999998} {i1<i2} 0 | 100 test_expr expr-1.50 {i1=99999999999, i2=99999999998} {i1<i2} 0 |
91 test_expr expr-1.51 {i1=99999999999, i2=99999999998} {i1=i2} 0 | 101 test_expr expr-1.51 {i1=99999999999, i2=99999999998} {i1=i2} 0 |
92 test_expr expr-1.52 {i1=99999999999, i2=99999999998} {i1>i2} 1 | 102 test_expr expr-1.52 {i1=99999999999, i2=99999999998} {i1>i2} 1 |
93 test_expr expr-1.53 {i1=099999999999, i2=99999999999} {i1<i2} 0 | 103 test_expr expr-1.53 {i1=099999999999, i2=99999999999} {i1<i2} 0 |
94 test_expr expr-1.54 {i1=099999999999, i2=99999999999} {i1=i2} 1 | 104 test_expr expr-1.54 {i1=099999999999, i2=99999999999} {i1=i2} 1 |
95 test_expr expr-1.55 {i1=099999999999, i2=99999999999} {i1>i2} 0 | 105 test_expr expr-1.55 {i1=099999999999, i2=99999999999} {i1>i2} 0 |
96 test_expr expr-1.56 {i1=25, i2=11} {i1%i2} 3 | 106 test_expr expr-1.56 {i1=25, i2=11} {i1%i2} 3 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 test_expr expr-1.102 {i1=40, i2=1} {i2<<i1} 1099511627776 | 157 test_expr expr-1.102 {i1=40, i2=1} {i2<<i1} 1099511627776 |
148 } | 158 } |
149 | 159 |
150 ifcapable floatingpoint { | 160 ifcapable floatingpoint { |
151 test_expr expr-1.103 {i1=0} {(-2147483648.0 % -1)} 0.0 | 161 test_expr expr-1.103 {i1=0} {(-2147483648.0 % -1)} 0.0 |
152 test_expr expr-1.104 {i1=0} {(-9223372036854775808.0 % -1)} 0.0 | 162 test_expr expr-1.104 {i1=0} {(-9223372036854775808.0 % -1)} 0.0 |
153 test_expr expr-1.105 {i1=0} {(-9223372036854775808.0 / -1)>1} 1 | 163 test_expr expr-1.105 {i1=0} {(-9223372036854775808.0 / -1)>1} 1 |
154 } | 164 } |
155 | 165 |
156 if {[working_64bit_int]} { | 166 if {[working_64bit_int]} { |
157 test_expr expr-1.106 {i1=0} {(1<<63)/-1} -9223372036854775808 | 167 test_expr expr-1.106 {i1=0} {-9223372036854775808/-1} 9.22337203685478e+18 |
158 } | 168 } |
159 | 169 |
160 test_expr expr-1.107 {i1=0} {(1<<63)%-1} 0 | 170 test_expr expr-1.107 {i1=0} {-9223372036854775808%-1} 0 |
161 test_expr expr-1.108 {i1=0} {1%0} {{}} | 171 test_expr expr-1.108 {i1=0} {1%0} {{}} |
162 test_expr expr-1.109 {i1=0} {1/0} {{}} | 172 test_expr expr-1.109 {i1=0} {1/0} {{}} |
163 | 173 |
164 if {[working_64bit_int]} { | 174 if {[working_64bit_int]} { |
165 test_expr expr-1.110 {i1=0} {-9223372036854775807/-1} 9223372036854775807 | 175 test_expr expr-1.110 {i1=0} {-9223372036854775807/-1} 9223372036854775807 |
166 } | 176 } |
167 | 177 |
| 178 test_expr expr-1.111 {i1=NULL, i2=8} {i1 IS i2} 0 |
| 179 test_expr expr-1.112 {i1=NULL, i2=NULL} {i1 IS i2} 1 |
| 180 test_expr expr-1.113 {i1=6, i2=NULL} {i1 IS i2} 0 |
| 181 test_expr expr-1.114 {i1=6, i2=6} {i1 IS i2} 1 |
| 182 test_expr expr-1.115 {i1=NULL, i2=8} \ |
| 183 {CASE WHEN i1 IS i2 THEN 'yes' ELSE 'no' END} no |
| 184 test_expr expr-1.116 {i1=NULL, i2=NULL} \ |
| 185 {CASE WHEN i1 IS i2 THEN 'yes' ELSE 'no' END} yes |
| 186 test_expr expr-1.117 {i1=6, i2=NULL} \ |
| 187 {CASE WHEN i1 IS i2 THEN 'yes' ELSE 'no' END} no |
| 188 test_expr expr-1.118 {i1=8, i2=8} \ |
| 189 {CASE WHEN i1 IS i2 THEN 'yes' ELSE 'no' END} yes |
| 190 test_expr expr-1.119 {i1=NULL, i2=8} {i1 IS NOT i2} 1 |
| 191 test_expr expr-1.120 {i1=NULL, i2=NULL} {i1 IS NOT i2} 0 |
| 192 test_expr expr-1.121 {i1=6, i2=NULL} {i1 IS NOT i2} 1 |
| 193 test_expr expr-1.122 {i1=6, i2=6} {i1 IS NOT i2} 0 |
| 194 test_expr expr-1.123 {i1=NULL, i2=8} \ |
| 195 {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} yes |
| 196 test_expr expr-1.124 {i1=NULL, i2=NULL} \ |
| 197 {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} no |
| 198 test_expr expr-1.125 {i1=6, i2=NULL} \ |
| 199 {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} yes |
| 200 test_expr expr-1.126 {i1=8, i2=8} \ |
| 201 {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} no |
| 202 |
| 203 ifcapable floatingpoint {if {[working_64bit_int]} { |
| 204 test_expr expr-1.200\ |
| 205 {i1=9223372036854775806, i2=1} {i1+i2} 9223372036854775807 |
| 206 test_expr expr-1.201\ |
| 207 {i1=9223372036854775806, i2=2} {i1+i2} 9.22337203685478e+18 |
| 208 test_expr expr-1.202\ |
| 209 {i1=9223372036854775806, i2=100000} {i1+i2} 9.22337203685488e+18 |
| 210 test_expr expr-1.203\ |
| 211 {i1=9223372036854775807, i2=0} {i1+i2} 9223372036854775807 |
| 212 test_expr expr-1.204\ |
| 213 {i1=9223372036854775807, i2=1} {i1+i2} 9.22337203685478e+18 |
| 214 test_expr expr-1.205\ |
| 215 {i2=9223372036854775806, i1=1} {i1+i2} 9223372036854775807 |
| 216 test_expr expr-1.206\ |
| 217 {i2=9223372036854775806, i1=2} {i1+i2} 9.22337203685478e+18 |
| 218 test_expr expr-1.207\ |
| 219 {i2=9223372036854775806, i1=100000} {i1+i2} 9.22337203685488e+18 |
| 220 test_expr expr-1.208\ |
| 221 {i2=9223372036854775807, i1=0} {i1+i2} 9223372036854775807 |
| 222 test_expr expr-1.209\ |
| 223 {i2=9223372036854775807, i1=1} {i1+i2} 9.22337203685478e+18 |
| 224 test_expr expr-1.210\ |
| 225 {i1=-9223372036854775807, i2=-1} {i1+i2} -9223372036854775808 |
| 226 test_expr expr-1.211\ |
| 227 {i1=-9223372036854775807, i2=-2} {i1+i2} -9.22337203685478e+18 |
| 228 test_expr expr-1.212\ |
| 229 {i1=-9223372036854775807, i2=-100000} {i1+i2} -9.22337203685488e+18 |
| 230 test_expr expr-1.213\ |
| 231 {i1=-9223372036854775808, i2=0} {i1+i2} -9223372036854775808 |
| 232 test_expr expr-1.214\ |
| 233 {i1=-9223372036854775808, i2=-1} {i1+i2} -9.22337203685478e+18 |
| 234 test_expr expr-1.215\ |
| 235 {i2=-9223372036854775807, i1=-1} {i1+i2} -9223372036854775808 |
| 236 test_expr expr-1.216\ |
| 237 {i2=-9223372036854775807, i1=-2} {i1+i2} -9.22337203685478e+18 |
| 238 test_expr expr-1.217\ |
| 239 {i2=-9223372036854775807, i1=-100000} {i1+i2} -9.22337203685488e+18 |
| 240 test_expr expr-1.218\ |
| 241 {i2=-9223372036854775808, i1=0} {i1+i2} -9223372036854775808 |
| 242 test_expr expr-1.219\ |
| 243 {i2=-9223372036854775808, i1=-1} {i1+i2} -9.22337203685478e+18 |
| 244 test_expr expr-1.220\ |
| 245 {i1=9223372036854775806, i2=-1} {i1-i2} 9223372036854775807 |
| 246 test_expr expr-1.221\ |
| 247 {i1=9223372036854775806, i2=-2} {i1-i2} 9.22337203685478e+18 |
| 248 test_expr expr-1.222\ |
| 249 {i1=9223372036854775806, i2=-100000} {i1-i2} 9.22337203685488e+18 |
| 250 test_expr expr-1.223\ |
| 251 {i1=9223372036854775807, i2=0} {i1-i2} 9223372036854775807 |
| 252 test_expr expr-1.224\ |
| 253 {i1=9223372036854775807, i2=-1} {i1-i2} 9.22337203685478e+18 |
| 254 test_expr expr-1.225\ |
| 255 {i2=-9223372036854775806, i1=1} {i1-i2} 9223372036854775807 |
| 256 test_expr expr-1.226\ |
| 257 {i2=-9223372036854775806, i1=2} {i1-i2} 9.22337203685478e+18 |
| 258 test_expr expr-1.227\ |
| 259 {i2=-9223372036854775806, i1=100000} {i1-i2} 9.22337203685488e+18 |
| 260 test_expr expr-1.228\ |
| 261 {i2=-9223372036854775807, i1=0} {i1-i2} 9223372036854775807 |
| 262 test_expr expr-1.229\ |
| 263 {i2=-9223372036854775807, i1=1} {i1-i2} 9.22337203685478e+18 |
| 264 test_expr expr-1.230\ |
| 265 {i1=-9223372036854775807, i2=1} {i1-i2} -9223372036854775808 |
| 266 test_expr expr-1.231\ |
| 267 {i1=-9223372036854775807, i2=2} {i1-i2} -9.22337203685478e+18 |
| 268 test_expr expr-1.232\ |
| 269 {i1=-9223372036854775807, i2=100000} {i1-i2} -9.22337203685488e+18 |
| 270 test_expr expr-1.233\ |
| 271 {i1=-9223372036854775808, i2=0} {i1-i2} -9223372036854775808 |
| 272 test_expr expr-1.234\ |
| 273 {i1=-9223372036854775808, i2=1} {i1-i2} -9.22337203685478e+18 |
| 274 test_expr expr-1.235\ |
| 275 {i2=9223372036854775807, i1=-1} {i1-i2} -9223372036854775808 |
| 276 test_expr expr-1.236\ |
| 277 {i2=9223372036854775807, i1=-2} {i1-i2} -9.22337203685478e+18 |
| 278 test_expr expr-1.237\ |
| 279 {i2=9223372036854775807, i1=-100000} {i1-i2} -9.22337203685488e+18 |
| 280 test_expr expr-1.238\ |
| 281 {i2=9223372036854775807, i1=0} {i1-i2} -9223372036854775807 |
| 282 test_expr expr-1.239\ |
| 283 {i2=9223372036854775807, i1=-1} {i1-i2} -9223372036854775808 |
| 284 |
| 285 test_expr expr-1.250\ |
| 286 {i1=4294967296, i2=2147483648} {i1*i2} 9.22337203685478e+18 |
| 287 test_expr expr-1.251\ |
| 288 {i1=4294967296, i2=2147483647} {i1*i2} 9223372032559808512 |
| 289 test_expr expr-1.252\ |
| 290 {i1=-4294967296, i2=2147483648} {i1*i2} -9223372036854775808 |
| 291 test_expr expr-1.253\ |
| 292 {i1=-4294967296, i2=2147483647} {i1*i2} -9223372032559808512 |
| 293 test_expr expr-1.254\ |
| 294 {i1=4294967296, i2=-2147483648} {i1*i2} -9223372036854775808 |
| 295 test_expr expr-1.255\ |
| 296 {i1=4294967296, i2=-2147483647} {i1*i2} -9223372032559808512 |
| 297 test_expr expr-1.256\ |
| 298 {i1=-4294967296, i2=-2147483648} {i1*i2} 9.22337203685478e+18 |
| 299 test_expr expr-1.257\ |
| 300 {i1=-4294967296, i2=-2147483647} {i1*i2} 9223372032559808512 |
| 301 |
| 302 }} |
| 303 |
168 ifcapable floatingpoint { | 304 ifcapable floatingpoint { |
169 test_expr expr-2.1 {r1=1.23, r2=2.34} {r1+r2} 3.57 | 305 test_expr expr-2.1 {r1=1.23, r2=2.34} {r1+r2} 3.57 |
170 test_expr expr-2.2 {r1=1.23, r2=2.34} {r1-r2} -1.11 | 306 test_expr expr-2.2 {r1=1.23, r2=2.34} {r1-r2} -1.11 |
171 test_expr expr-2.3 {r1=1.23, r2=2.34} {r1*r2} 2.8782 | 307 test_expr expr-2.3 {r1=1.23, r2=2.34} {r1*r2} 2.8782 |
172 } | 308 } |
173 set tcl_precision 15 | 309 set tcl_precision 15 |
174 ifcapable floatingpoint { | 310 ifcapable floatingpoint { |
175 test_expr expr-2.4 {r1=1.23, r2=2.34} {r1/r2} 0.525641025641026 | 311 test_expr expr-2.4 {r1=1.23, r2=2.34} {r1/r2} 0.525641025641026 |
176 test_expr expr-2.5 {r1=1.23, r2=2.34} {r2/r1} 1.90243902439024 | 312 test_expr expr-2.5 {r1=1.23, r2=2.34} {r2/r1} 1.90243902439024 |
177 test_expr expr-2.6 {r1=1.23, r2=2.34} {r2<r1} 0 | 313 test_expr expr-2.6 {r1=1.23, r2=2.34} {r2<r1} 0 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 test_expr expr-4.9 {t1='0.0', t2='abc'} {t1==t2} 0 | 394 test_expr expr-4.9 {t1='0.0', t2='abc'} {t1==t2} 0 |
259 | 395 |
260 ifcapable floatingpoint { | 396 ifcapable floatingpoint { |
261 test_expr expr-4.10 {r1='0.0', r2='abc'} {r1>r2} 0 | 397 test_expr expr-4.10 {r1='0.0', r2='abc'} {r1>r2} 0 |
262 test_expr expr-4.11 {r1='abc', r2='Abc'} {r1<r2} 0 | 398 test_expr expr-4.11 {r1='abc', r2='Abc'} {r1<r2} 0 |
263 test_expr expr-4.12 {r1='abc', r2='Abc'} {r1>r2} 1 | 399 test_expr expr-4.12 {r1='abc', r2='Abc'} {r1>r2} 1 |
264 test_expr expr-4.13 {r1='abc', r2='Bbc'} {r1<r2} 0 | 400 test_expr expr-4.13 {r1='abc', r2='Bbc'} {r1<r2} 0 |
265 test_expr expr-4.14 {r1='abc', r2='Bbc'} {r1>r2} 1 | 401 test_expr expr-4.14 {r1='abc', r2='Bbc'} {r1>r2} 1 |
266 test_expr expr-4.15 {r1='0', r2='0.0'} {r1==r2} 1 | 402 test_expr expr-4.15 {r1='0', r2='0.0'} {r1==r2} 1 |
267 test_expr expr-4.16 {r1='0.000', r2='0.0'} {r1==r2} 1 | 403 test_expr expr-4.16 {r1='0.000', r2='0.0'} {r1==r2} 1 |
268 test_expr expr-4.17 {r1=' 0.000', r2=' 0.0'} {r1==r2} 0 | 404 test_expr expr-4.17 {r1=' 0.000', r2=' 0.0'} {r1==r2} 1 |
269 test_expr expr-4.18 {r1='0.0', r2='abc'} {r1<r2} 1 | 405 test_expr expr-4.18 {r1='0.0', r2='abc'} {r1<r2} 1 |
270 test_expr expr-4.19 {r1='0.0', r2='abc'} {r1==r2} 0 | 406 test_expr expr-4.19 {r1='0.0', r2='abc'} {r1==r2} 0 |
271 test_expr expr-4.20 {r1='0.0', r2='abc'} {r1>r2} 0 | 407 test_expr expr-4.20 {r1='0.0', r2='abc'} {r1>r2} 0 |
272 } | 408 } |
273 | 409 |
274 # CSL is true if LIKE is case sensitive and false if not. | 410 # CSL is true if LIKE is case sensitive and false if not. |
275 # NCSL is the opposite. Use these variables as the result | 411 # NCSL is the opposite. Use these variables as the result |
276 # on operations where case makes a difference. | 412 # on operations where case makes a difference. |
277 set CSL $sqlite_options(casesensitivelike) | 413 set CSL $sqlite_options(casesensitivelike) |
278 set NCSL [expr {!$CSL}] | 414 set NCSL [expr {!$CSL}] |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 } | 929 } |
794 } {9.22337203685478e+18} | 930 } {9.22337203685478e+18} |
795 do_test expr-13.7 { | 931 do_test expr-13.7 { |
796 execsql { | 932 execsql { |
797 SELECT '9223372036854775807.0'+0 | 933 SELECT '9223372036854775807.0'+0 |
798 } | 934 } |
799 } {9.22337203685478e+18} | 935 } {9.22337203685478e+18} |
800 | 936 |
801 | 937 |
802 finish_test | 938 finish_test |
OLD | NEW |