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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } {0.0 0.0 0.0 0.0 0.0} | 228 } {0.0 0.0 0.0 0.0 0.0} |
229 do_test func-4.14 { | 229 do_test func-4.14 { |
230 execsql {SELECT typeof(round(5.1,1));} | 230 execsql {SELECT typeof(round(5.1,1));} |
231 } {real} | 231 } {real} |
232 do_test func-4.15 { | 232 do_test func-4.15 { |
233 execsql {SELECT typeof(round(5.1));} | 233 execsql {SELECT typeof(round(5.1));} |
234 } {real} | 234 } {real} |
235 do_test func-4.16 { | 235 do_test func-4.16 { |
236 catchsql {SELECT round(b,2.0) FROM t1 ORDER BY b} | 236 catchsql {SELECT round(b,2.0) FROM t1 ORDER BY b} |
237 } {0 {-2.0 1.23 2.0}} | 237 } {0 {-2.0 1.23 2.0}} |
| 238 # Verify some values reported on the mailing list. |
| 239 # Some of these fail on MSVC builds with 64-bit |
| 240 # long doubles, but not on GCC builds with 80-bit |
| 241 # long doubles. |
| 242 for {set i 1} {$i<999} {incr i} { |
| 243 set x1 [expr 40222.5 + $i] |
| 244 set x2 [expr 40223.0 + $i] |
| 245 do_test func-4.17.$i { |
| 246 execsql {SELECT round($x1);} |
| 247 } $x2 |
| 248 } |
| 249 for {set i 1} {$i<999} {incr i} { |
| 250 set x1 [expr 40222.05 + $i] |
| 251 set x2 [expr 40222.10 + $i] |
| 252 do_test func-4.18.$i { |
| 253 execsql {SELECT round($x1,1);} |
| 254 } $x2 |
| 255 } |
| 256 do_test func-4.20 { |
| 257 execsql {SELECT round(40223.4999999999);} |
| 258 } {40223.0} |
| 259 do_test func-4.21 { |
| 260 execsql {SELECT round(40224.4999999999);} |
| 261 } {40224.0} |
| 262 do_test func-4.22 { |
| 263 execsql {SELECT round(40225.4999999999);} |
| 264 } {40225.0} |
| 265 for {set i 1} {$i<10} {incr i} { |
| 266 do_test func-4.23.$i { |
| 267 execsql {SELECT round(40223.4999999999,$i);} |
| 268 } {40223.5} |
| 269 do_test func-4.24.$i { |
| 270 execsql {SELECT round(40224.4999999999,$i);} |
| 271 } {40224.5} |
| 272 do_test func-4.25.$i { |
| 273 execsql {SELECT round(40225.4999999999,$i);} |
| 274 } {40225.5} |
| 275 } |
| 276 for {set i 10} {$i<32} {incr i} { |
| 277 do_test func-4.26.$i { |
| 278 execsql {SELECT round(40223.4999999999,$i);} |
| 279 } {40223.4999999999} |
| 280 do_test func-4.27.$i { |
| 281 execsql {SELECT round(40224.4999999999,$i);} |
| 282 } {40224.4999999999} |
| 283 do_test func-4.28.$i { |
| 284 execsql {SELECT round(40225.4999999999,$i);} |
| 285 } {40225.4999999999} |
| 286 } |
| 287 do_test func-4.29 { |
| 288 execsql {SELECT round(1234567890.5);} |
| 289 } {1234567891.0} |
| 290 do_test func-4.30 { |
| 291 execsql {SELECT round(12345678901.5);} |
| 292 } {12345678902.0} |
| 293 do_test func-4.31 { |
| 294 execsql {SELECT round(123456789012.5);} |
| 295 } {123456789013.0} |
| 296 do_test func-4.32 { |
| 297 execsql {SELECT round(1234567890123.5);} |
| 298 } {1234567890124.0} |
| 299 do_test func-4.33 { |
| 300 execsql {SELECT round(12345678901234.5);} |
| 301 } {12345678901235.0} |
| 302 do_test func-4.34 { |
| 303 execsql {SELECT round(1234567890123.35,1);} |
| 304 } {1234567890123.4} |
| 305 do_test func-4.35 { |
| 306 execsql {SELECT round(1234567890123.445,2);} |
| 307 } {1234567890123.45} |
| 308 do_test func-4.36 { |
| 309 execsql {SELECT round(99999999999994.5);} |
| 310 } {99999999999995.0} |
| 311 do_test func-4.37 { |
| 312 execsql {SELECT round(9999999999999.55,1);} |
| 313 } {9999999999999.6} |
| 314 do_test func-4.38 { |
| 315 execsql {SELECT round(9999999999999.555,2);} |
| 316 } {9999999999999.56} |
238 } | 317 } |
239 | 318 |
240 # Test the upper() and lower() functions | 319 # Test the upper() and lower() functions |
241 # | 320 # |
242 do_test func-5.1 { | 321 do_test func-5.1 { |
243 execsql {SELECT upper(t1) FROM tbl1} | 322 execsql {SELECT upper(t1) FROM tbl1} |
244 } {THIS PROGRAM IS FREE SOFTWARE} | 323 } {THIS PROGRAM IS FREE SOFTWARE} |
245 do_test func-5.2 { | 324 do_test func-5.2 { |
246 execsql {SELECT lower(upper(t1)) FROM tbl1} | 325 execsql {SELECT lower(upper(t1)) FROM tbl1} |
247 } {this program is free software} | 326 } {this program is free software} |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 do_test func-28.1 { | 1241 do_test func-28.1 { |
1163 db eval { | 1242 db eval { |
1164 CREATE TABLE t28(x, y DEFAULT(nosuchfunc(1))); | 1243 CREATE TABLE t28(x, y DEFAULT(nosuchfunc(1))); |
1165 } | 1244 } |
1166 catchsql { | 1245 catchsql { |
1167 INSERT INTO t28(x) VALUES(1); | 1246 INSERT INTO t28(x) VALUES(1); |
1168 } | 1247 } |
1169 } {1 {unknown function: nosuchfunc()}} | 1248 } {1 {unknown function: nosuchfunc()}} |
1170 | 1249 |
1171 finish_test | 1250 finish_test |
OLD | NEW |