interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / test / tkt-a8a0d2996a.test

95 lines · 2627 bytes Raw Blame History
1# 2014-03-24
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#
12# Tests to verify that arithmetic operators do not change the type of
13# input operands. Ticket [a8a0d2996a]
14#
15
16set testdir [file dirname $argv0]
17source $testdir/tester.tcl
18set testprefix tkt-a8a0d2996a
19
20do_execsql_test 1.0 {
21 CREATE TABLE t(x,y);
22 INSERT INTO t VALUES('1','1');
23 SELECT typeof(x), typeof(y) FROM t WHERE 1=x+0 AND y=='1';
24} {text text}
25do_execsql_test 1.1 {
26 SELECT typeof(x), typeof(y) FROM t WHERE 1=x-0 AND y=='1';
27} {text text}
28do_execsql_test 1.2 {
29 SELECT typeof(x), typeof(y) FROM t WHERE 1=x*1 AND y=='1';
30} {text text}
31do_execsql_test 1.3 {
32 SELECT typeof(x), typeof(y) FROM t WHERE 1=x/1 AND y=='1';
33} {text text}
34do_execsql_test 1.4 {
35 SELECT typeof(x), typeof(y) FROM t WHERE 1=x%4 AND y=='1';
36} {text text}
37
38do_execsql_test 2.0 {
39 UPDATE t SET x='1xyzzy';
40 SELECT typeof(x), typeof(y) FROM t WHERE 1=x+0 AND y=='1';
41} {text text}
42do_execsql_test 2.1 {
43 SELECT typeof(x), typeof(y) FROM t WHERE 1=x-0 AND y=='1';
44} {text text}
45do_execsql_test 2.2 {
46 SELECT typeof(x), typeof(y) FROM t WHERE 1=x*1 AND y=='1';
47} {text text}
48do_execsql_test 2.3 {
49 SELECT typeof(x), typeof(y) FROM t WHERE 1=x/1 AND y=='1';
50} {text text}
51do_execsql_test 2.4 {
52 SELECT typeof(x), typeof(y) FROM t WHERE 1=x%4 AND y=='1';
53} {text text}
54
55
56do_execsql_test 3.0 {
57 UPDATE t SET x='1.0';
58 SELECT typeof(x), typeof(y) FROM t WHERE 1=x+0 AND y=='1';
59} {text text}
60do_execsql_test 3.1 {
61 SELECT typeof(x), typeof(y) FROM t WHERE 1=x-0 AND y=='1';
62} {text text}
63do_execsql_test 3.2 {
64 SELECT typeof(x), typeof(y) FROM t WHERE 1=x*1 AND y=='1';
65} {text text}
66do_execsql_test 3.3 {
67 SELECT typeof(x), typeof(y) FROM t WHERE 1=x/1 AND y=='1';
68} {text text}
69do_execsql_test 3.4 {
70 SELECT typeof(x), typeof(y) FROM t WHERE 1=x%4 AND y=='1';
71} {text text}
72
73do_execsql_test 4.0 {
74 SELECT 1+1.;
75} {2.0}
76do_execsql_test 4.1 {
77 SELECT '1.23e64'/'1.0000e+62';
78} {123.0}
79do_execsql_test 4.2 {
80 SELECT '100x'+'-2y';
81} {98}
82do_execsql_test 4.3 {
83 SELECT '100x'+'4.5y';
84} {104.5}
85do_execsql_test 4.4 {
86 SELECT '-9223372036854775807x'-'1x';
87} {-9223372036854775808}
88do_execsql_test 4.5 {
89 SELECT '9223372036854775806x'+'1x';
90} {9223372036854775807}
91do_execsql_test 4.6 {
92 SELECT '1234x'/'10y', '1234x'/'10.y', '1234x'/'1e1y';
93} {123 123.4 123.4}
94
95finish_test