/ Check-in [2e5c0ed7]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge windows test case fixes. No changes to code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2e5c0ed724060388b97e0c0881bb1b68ec1a23b4
User & Date: dan 2011-05-06 13:58:03
Context
2011-05-06
18:55
Merge the uri branch with the trunk. check-in: 88df33c4 user: dan tags: trunk
13:58
Merge windows test case fixes. No changes to code. check-in: 2e5c0ed7 user: dan tags: trunk
00:19
Increase the iVersion for sqlite3_module needed for the xSavepoint, xRelease, and xRollbackTo methods from 1 to 2. This is so that it will conform to published documentation. check-in: 0f4954e9 user: drh tags: trunk
2011-05-05
19:44
Changes to various test scripts so that they pass on windows. Closed-Leaf check-in: 1586244b user: dan tags: win32-test-fixes
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/alter.test.

646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
    SELECT $::col_name, $::col_name2 FROM $::tbl_name;
  "
} {4 5}

# Ticket #1665:  Make sure ALTER TABLE ADD COLUMN works on a table
# that includes a COLLATE clause.
#
do_test alter-7.1 {
  execsql {
    CREATE TABLE t1(a TEXT COLLATE BINARY);
    ALTER TABLE t1 ADD COLUMN b INTEGER COLLATE NOCASE;
    INSERT INTO t1 VALUES(1,'-2');
    INSERT INTO t1 VALUES(5.4e-08,'5.4e-08');
    SELECT typeof(a), a, typeof(b), b FROM t1;
  }







|







646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
    SELECT $::col_name, $::col_name2 FROM $::tbl_name;
  "
} {4 5}

# Ticket #1665:  Make sure ALTER TABLE ADD COLUMN works on a table
# that includes a COLLATE clause.
#
do_realnum_test alter-7.1 {
  execsql {
    CREATE TABLE t1(a TEXT COLLATE BINARY);
    ALTER TABLE t1 ADD COLUMN b INTEGER COLLATE NOCASE;
    INSERT INTO t1 VALUES(1,'-2');
    INSERT INTO t1 VALUES(5.4e-08,'5.4e-08');
    SELECT typeof(a), a, typeof(b), b FROM t1;
  }

Changes to test/cast.test.

230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
...
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
#
do_test cast-3.1 {
  execsql {SELECT CAST(9223372036854774800 AS integer)}
} 9223372036854774800
do_test cast-3.2 {
  execsql {SELECT CAST(9223372036854774800 AS numeric)}
} 9223372036854774800
do_test cast-3.3 {
  execsql {SELECT CAST(9223372036854774800 AS real)}
} 9.22337203685477e+18
do_test cast-3.4 {
  execsql {SELECT CAST(CAST(9223372036854774800 AS real) AS integer)}
} 9223372036854774784
do_test cast-3.5 {
  execsql {SELECT CAST(-9223372036854774800 AS integer)}
} -9223372036854774800
do_test cast-3.6 {
  execsql {SELECT CAST(-9223372036854774800 AS numeric)}
} -9223372036854774800
do_test cast-3.7 {
  execsql {SELECT CAST(-9223372036854774800 AS real)}
} -9.22337203685477e+18
do_test cast-3.8 {
  execsql {SELECT CAST(CAST(-9223372036854774800 AS real) AS integer)}
} -9223372036854774784
do_test cast-3.11 {
  execsql {SELECT CAST('9223372036854774800' AS integer)}
} 9223372036854774800
do_test cast-3.12 {
  execsql {SELECT CAST('9223372036854774800' AS numeric)}
} 9223372036854774800
do_test cast-3.13 {
  execsql {SELECT CAST('9223372036854774800' AS real)}
} 9.22337203685477e+18
ifcapable long_double {
  do_test cast-3.14 {
    execsql {SELECT CAST(CAST('9223372036854774800' AS real) AS integer)}
  } 9223372036854774784
}
do_test cast-3.15 {
  execsql {SELECT CAST('-9223372036854774800' AS integer)}
} -9223372036854774800
do_test cast-3.16 {
  execsql {SELECT CAST('-9223372036854774800' AS numeric)}
} -9223372036854774800
do_test cast-3.17 {
  execsql {SELECT CAST('-9223372036854774800' AS real)}
} -9.22337203685477e+18
ifcapable long_double {
  do_test cast-3.18 {
    execsql {SELECT CAST(CAST('-9223372036854774800' AS real) AS integer)}
  } -9223372036854774784
}
................................................................................
if {[db eval {PRAGMA encoding}]=="UTF-8"} {
  do_test cast-3.21 {
    execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS integer)}
  } 9223372036854774800
  do_test cast-3.22 {
    execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS numeric)}
  } 9223372036854774800
  do_test cast-3.23 {
    execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS real)}
  } 9.22337203685477e+18
  ifcapable long_double {
    do_test cast-3.24 {
      execsql {
        SELECT CAST(CAST(x'39323233333732303336383534373734383030' AS real)
                    AS integer)







|











|











|













|







 







|







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
...
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
#
do_test cast-3.1 {
  execsql {SELECT CAST(9223372036854774800 AS integer)}
} 9223372036854774800
do_test cast-3.2 {
  execsql {SELECT CAST(9223372036854774800 AS numeric)}
} 9223372036854774800
do_realnum_test cast-3.3 {
  execsql {SELECT CAST(9223372036854774800 AS real)}
} 9.22337203685477e+18
do_test cast-3.4 {
  execsql {SELECT CAST(CAST(9223372036854774800 AS real) AS integer)}
} 9223372036854774784
do_test cast-3.5 {
  execsql {SELECT CAST(-9223372036854774800 AS integer)}
} -9223372036854774800
do_test cast-3.6 {
  execsql {SELECT CAST(-9223372036854774800 AS numeric)}
} -9223372036854774800
do_realnum_test cast-3.7 {
  execsql {SELECT CAST(-9223372036854774800 AS real)}
} -9.22337203685477e+18
do_test cast-3.8 {
  execsql {SELECT CAST(CAST(-9223372036854774800 AS real) AS integer)}
} -9223372036854774784
do_test cast-3.11 {
  execsql {SELECT CAST('9223372036854774800' AS integer)}
} 9223372036854774800
do_test cast-3.12 {
  execsql {SELECT CAST('9223372036854774800' AS numeric)}
} 9223372036854774800
do_realnum_test cast-3.13 {
  execsql {SELECT CAST('9223372036854774800' AS real)}
} 9.22337203685477e+18
ifcapable long_double {
  do_test cast-3.14 {
    execsql {SELECT CAST(CAST('9223372036854774800' AS real) AS integer)}
  } 9223372036854774784
}
do_test cast-3.15 {
  execsql {SELECT CAST('-9223372036854774800' AS integer)}
} -9223372036854774800
do_test cast-3.16 {
  execsql {SELECT CAST('-9223372036854774800' AS numeric)}
} -9223372036854774800
do_realnum_test cast-3.17 {
  execsql {SELECT CAST('-9223372036854774800' AS real)}
} -9.22337203685477e+18
ifcapable long_double {
  do_test cast-3.18 {
    execsql {SELECT CAST(CAST('-9223372036854774800' AS real) AS integer)}
  } -9223372036854774784
}
................................................................................
if {[db eval {PRAGMA encoding}]=="UTF-8"} {
  do_test cast-3.21 {
    execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS integer)}
  } 9223372036854774800
  do_test cast-3.22 {
    execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS numeric)}
  } 9223372036854774800
  do_realnum_test cast-3.23 {
    execsql {SELECT CAST(x'39323233333732303336383534373734383030' AS real)}
  } 9.22337203685477e+18
  ifcapable long_double {
    do_test cast-3.24 {
      execsql {
        SELECT CAST(CAST(x'39323233333732303336383534373734383030' AS real)
                    AS integer)

Changes to test/expr.test.

28
29
30
31
32
33
34





35
36
37
38
39
40
41
...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
...
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
...
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
...
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
}

proc test_expr {name settings expr result} {
  do_test $name [format {
    execsql {BEGIN; UPDATE test1 SET %s; SELECT %s FROM test1; ROLLBACK;}
  } $settings $expr] $result
}






test_expr expr-1.1 {i1=10, i2=20} {i1+i2} 30
test_expr expr-1.2 {i1=10, i2=20} {i1-i2} -10
test_expr expr-1.3 {i1=10, i2=20} {i1*i2} 200
test_expr expr-1.4 {i1=10, i2=20} {i1/i2} 0
test_expr expr-1.5 {i1=10, i2=20} {i2/i1} 2
test_expr expr-1.6 {i1=10, i2=20} {i2<i1} 0
................................................................................
ifcapable floatingpoint {
  test_expr expr-1.103 {i1=0} {(-2147483648.0 % -1)} 0.0
  test_expr expr-1.104 {i1=0} {(-9223372036854775808.0 % -1)} 0.0
  test_expr expr-1.105 {i1=0} {(-9223372036854775808.0 / -1)>1} 1
}

if {[working_64bit_int]} {
  test_expr expr-1.106 {i1=0} {-9223372036854775808/-1} 9.22337203685478e+18
}

test_expr expr-1.107 {i1=0} {-9223372036854775808%-1} 0
test_expr expr-1.108 {i1=0} {1%0} {{}}
test_expr expr-1.109 {i1=0} {1/0} {{}}

if {[working_64bit_int]} {
................................................................................
  {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} yes
test_expr expr-1.126 {i1=8, i2=8} \
  {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} no

ifcapable floatingpoint {if {[working_64bit_int]} {
  test_expr expr-1.200\
      {i1=9223372036854775806, i2=1} {i1+i2}      9223372036854775807
  test_expr expr-1.201\
      {i1=9223372036854775806, i2=2} {i1+i2}      9.22337203685478e+18
  test_expr expr-1.202\
      {i1=9223372036854775806, i2=100000} {i1+i2} 9.22337203685488e+18
  test_expr expr-1.203\
      {i1=9223372036854775807, i2=0} {i1+i2}      9223372036854775807
  test_expr expr-1.204\
      {i1=9223372036854775807, i2=1} {i1+i2}      9.22337203685478e+18
  test_expr expr-1.205\
      {i2=9223372036854775806, i1=1} {i1+i2}      9223372036854775807
  test_expr expr-1.206\
      {i2=9223372036854775806, i1=2} {i1+i2}      9.22337203685478e+18
  test_expr expr-1.207\
      {i2=9223372036854775806, i1=100000} {i1+i2} 9.22337203685488e+18
  test_expr expr-1.208\
      {i2=9223372036854775807, i1=0} {i1+i2}      9223372036854775807
  test_expr expr-1.209\
      {i2=9223372036854775807, i1=1} {i1+i2}      9.22337203685478e+18
  test_expr expr-1.210\
      {i1=-9223372036854775807, i2=-1} {i1+i2}    -9223372036854775808
  test_expr expr-1.211\
      {i1=-9223372036854775807, i2=-2} {i1+i2}    -9.22337203685478e+18
  test_expr expr-1.212\
      {i1=-9223372036854775807, i2=-100000} {i1+i2} -9.22337203685488e+18
  test_expr expr-1.213\
      {i1=-9223372036854775808, i2=0} {i1+i2}     -9223372036854775808
  test_expr expr-1.214\
      {i1=-9223372036854775808, i2=-1} {i1+i2}    -9.22337203685478e+18
  test_expr expr-1.215\
      {i2=-9223372036854775807, i1=-1} {i1+i2}    -9223372036854775808
  test_expr expr-1.216\
      {i2=-9223372036854775807, i1=-2} {i1+i2}    -9.22337203685478e+18
  test_expr expr-1.217\
      {i2=-9223372036854775807, i1=-100000} {i1+i2} -9.22337203685488e+18
  test_expr expr-1.218\
      {i2=-9223372036854775808, i1=0} {i1+i2}     -9223372036854775808
  test_expr expr-1.219\
      {i2=-9223372036854775808, i1=-1} {i1+i2}    -9.22337203685478e+18
  test_expr expr-1.220\
      {i1=9223372036854775806, i2=-1} {i1-i2}     9223372036854775807
  test_expr expr-1.221\
      {i1=9223372036854775806, i2=-2} {i1-i2}      9.22337203685478e+18
  test_expr expr-1.222\
      {i1=9223372036854775806, i2=-100000} {i1-i2} 9.22337203685488e+18
  test_expr expr-1.223\
      {i1=9223372036854775807, i2=0} {i1-i2}      9223372036854775807
  test_expr expr-1.224\
      {i1=9223372036854775807, i2=-1} {i1-i2}      9.22337203685478e+18
  test_expr expr-1.225\
      {i2=-9223372036854775806, i1=1} {i1-i2}      9223372036854775807
  test_expr expr-1.226\
      {i2=-9223372036854775806, i1=2} {i1-i2}      9.22337203685478e+18
  test_expr expr-1.227\
      {i2=-9223372036854775806, i1=100000} {i1-i2} 9.22337203685488e+18
  test_expr expr-1.228\
      {i2=-9223372036854775807, i1=0} {i1-i2}      9223372036854775807
  test_expr expr-1.229\
      {i2=-9223372036854775807, i1=1} {i1-i2}      9.22337203685478e+18
  test_expr expr-1.230\
      {i1=-9223372036854775807, i2=1} {i1-i2}    -9223372036854775808
  test_expr expr-1.231\
      {i1=-9223372036854775807, i2=2} {i1-i2}    -9.22337203685478e+18
  test_expr expr-1.232\
      {i1=-9223372036854775807, i2=100000} {i1-i2} -9.22337203685488e+18
  test_expr expr-1.233\
      {i1=-9223372036854775808, i2=0} {i1-i2}     -9223372036854775808
  test_expr expr-1.234\
      {i1=-9223372036854775808, i2=1} {i1-i2}    -9.22337203685478e+18
  test_expr expr-1.235\
      {i2=9223372036854775807, i1=-1} {i1-i2}    -9223372036854775808
  test_expr expr-1.236\
      {i2=9223372036854775807, i1=-2} {i1-i2}    -9.22337203685478e+18
  test_expr expr-1.237\
      {i2=9223372036854775807, i1=-100000} {i1-i2} -9.22337203685488e+18
  test_expr expr-1.238\
      {i2=9223372036854775807, i1=0} {i1-i2}     -9223372036854775807
  test_expr expr-1.239\
      {i2=9223372036854775807, i1=-1} {i1-i2}    -9223372036854775808

  test_expr expr-1.250\
      {i1=4294967296, i2=2147483648} {i1*i2}      9.22337203685478e+18
  test_expr expr-1.251\
      {i1=4294967296, i2=2147483647} {i1*i2}      9223372032559808512
  test_expr expr-1.252\
      {i1=-4294967296, i2=2147483648} {i1*i2}     -9223372036854775808
  test_expr expr-1.253\
      {i1=-4294967296, i2=2147483647} {i1*i2}     -9223372032559808512
  test_expr expr-1.254\
      {i1=4294967296, i2=-2147483648} {i1*i2}     -9223372036854775808
  test_expr expr-1.255\
      {i1=4294967296, i2=-2147483647} {i1*i2}     -9223372032559808512
  test_expr expr-1.256\
      {i1=-4294967296, i2=-2147483648} {i1*i2}    9.22337203685478e+18
  test_expr expr-1.257\
      {i1=-4294967296, i2=-2147483647} {i1*i2}    9223372032559808512

}}

ifcapable floatingpoint {
  test_expr expr-2.1 {r1=1.23, r2=2.34} {r1+r2} 3.57
  test_expr expr-2.2 {r1=1.23, r2=2.34} {r1-r2} -1.11
................................................................................
do_test expr-12.2 {
  catchsql {
    SELECT (CASE WHEN a>4 THEN 1 ELSE 0) FROM test1;
  }
} {1 {near ")": syntax error}}

ifcapable floatingpoint {
  do_test expr-13.1 {
    execsql {
      SELECT 12345678901234567890;
    }
  } {1.23456789012346e+19}
}

# Implicit String->Integer conversion is used when possible.
................................................................................
    }
  } {9223372036854775807}
}

# If the value is too large, use String->Float conversion.
#
ifcapable floatingpoint {
  do_test expr-13.4 {
    execsql {
      SELECT 0+'9223372036854775808'
    }
  } {9.22337203685478e+18}
  do_test expr-13.5 {
    execsql {
      SELECT '9223372036854775808'+0
    }
  } {9.22337203685478e+18}
}

# Use String->float conversion if the value is explicitly a floating
# point value.
#
do_test expr-13.6 {
  execsql {
    SELECT 0+'9223372036854775807.0'
  }
} {9.22337203685478e+18}
do_test expr-13.7 {
  execsql {
    SELECT '9223372036854775807.0'+0
  }
} {9.22337203685478e+18}


finish_test







>
>
>
>
>







 







|







 







|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|

|


|

|

|

|

|

|

|

|







 







|







 







|




|









|




|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
...
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
...
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
...
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
...
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
}

proc test_expr {name settings expr result} {
  do_test $name [format {
    execsql {BEGIN; UPDATE test1 SET %s; SELECT %s FROM test1; ROLLBACK;}
  } $settings $expr] $result
}
proc test_realnum_expr {name settings expr result} {
  do_realnum_test $name [format {
    execsql {BEGIN; UPDATE test1 SET %s; SELECT %s FROM test1; ROLLBACK;}
  } $settings $expr] $result
}

test_expr expr-1.1 {i1=10, i2=20} {i1+i2} 30
test_expr expr-1.2 {i1=10, i2=20} {i1-i2} -10
test_expr expr-1.3 {i1=10, i2=20} {i1*i2} 200
test_expr expr-1.4 {i1=10, i2=20} {i1/i2} 0
test_expr expr-1.5 {i1=10, i2=20} {i2/i1} 2
test_expr expr-1.6 {i1=10, i2=20} {i2<i1} 0
................................................................................
ifcapable floatingpoint {
  test_expr expr-1.103 {i1=0} {(-2147483648.0 % -1)} 0.0
  test_expr expr-1.104 {i1=0} {(-9223372036854775808.0 % -1)} 0.0
  test_expr expr-1.105 {i1=0} {(-9223372036854775808.0 / -1)>1} 1
}

if {[working_64bit_int]} {
  test_realnum_expr expr-1.106 {i1=0} {-9223372036854775808/-1} 9.22337203685478e+18
}

test_expr expr-1.107 {i1=0} {-9223372036854775808%-1} 0
test_expr expr-1.108 {i1=0} {1%0} {{}}
test_expr expr-1.109 {i1=0} {1/0} {{}}

if {[working_64bit_int]} {
................................................................................
  {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} yes
test_expr expr-1.126 {i1=8, i2=8} \
  {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} no

ifcapable floatingpoint {if {[working_64bit_int]} {
  test_expr expr-1.200\
      {i1=9223372036854775806, i2=1} {i1+i2}      9223372036854775807
  test_realnum_expr expr-1.201\
      {i1=9223372036854775806, i2=2} {i1+i2}      9.22337203685478e+18
  test_realnum_expr expr-1.202\
      {i1=9223372036854775806, i2=100000} {i1+i2} 9.22337203685488e+18
  test_realnum_expr expr-1.203\
      {i1=9223372036854775807, i2=0} {i1+i2}      9223372036854775807
  test_realnum_expr expr-1.204\
      {i1=9223372036854775807, i2=1} {i1+i2}      9.22337203685478e+18
  test_realnum_expr expr-1.205\
      {i2=9223372036854775806, i1=1} {i1+i2}      9223372036854775807
  test_realnum_expr expr-1.206\
      {i2=9223372036854775806, i1=2} {i1+i2}      9.22337203685478e+18
  test_realnum_expr expr-1.207\
      {i2=9223372036854775806, i1=100000} {i1+i2} 9.22337203685488e+18
  test_realnum_expr expr-1.208\
      {i2=9223372036854775807, i1=0} {i1+i2}      9223372036854775807
  test_realnum_expr expr-1.209\
      {i2=9223372036854775807, i1=1} {i1+i2}      9.22337203685478e+18
  test_realnum_expr expr-1.210\
      {i1=-9223372036854775807, i2=-1} {i1+i2}    -9223372036854775808
  test_realnum_expr expr-1.211\
      {i1=-9223372036854775807, i2=-2} {i1+i2}    -9.22337203685478e+18
  test_realnum_expr expr-1.212\
      {i1=-9223372036854775807, i2=-100000} {i1+i2} -9.22337203685488e+18
  test_realnum_expr expr-1.213\
      {i1=-9223372036854775808, i2=0} {i1+i2}     -9223372036854775808
  test_realnum_expr expr-1.214\
      {i1=-9223372036854775808, i2=-1} {i1+i2}    -9.22337203685478e+18
  test_realnum_expr expr-1.215\
      {i2=-9223372036854775807, i1=-1} {i1+i2}    -9223372036854775808
  test_realnum_expr expr-1.216\
      {i2=-9223372036854775807, i1=-2} {i1+i2}    -9.22337203685478e+18
  test_realnum_expr expr-1.217\
      {i2=-9223372036854775807, i1=-100000} {i1+i2} -9.22337203685488e+18
  test_realnum_expr expr-1.218\
      {i2=-9223372036854775808, i1=0} {i1+i2}     -9223372036854775808
  test_realnum_expr expr-1.219\
      {i2=-9223372036854775808, i1=-1} {i1+i2}    -9.22337203685478e+18
  test_realnum_expr expr-1.220\
      {i1=9223372036854775806, i2=-1} {i1-i2}     9223372036854775807
  test_realnum_expr expr-1.221\
      {i1=9223372036854775806, i2=-2} {i1-i2}      9.22337203685478e+18
  test_realnum_expr expr-1.222\
      {i1=9223372036854775806, i2=-100000} {i1-i2} 9.22337203685488e+18
  test_realnum_expr expr-1.223\
      {i1=9223372036854775807, i2=0} {i1-i2}      9223372036854775807
  test_realnum_expr expr-1.224\
      {i1=9223372036854775807, i2=-1} {i1-i2}      9.22337203685478e+18
  test_realnum_expr expr-1.225\
      {i2=-9223372036854775806, i1=1} {i1-i2}      9223372036854775807
  test_realnum_expr expr-1.226\
      {i2=-9223372036854775806, i1=2} {i1-i2}      9.22337203685478e+18
  test_realnum_expr expr-1.227\
      {i2=-9223372036854775806, i1=100000} {i1-i2} 9.22337203685488e+18
  test_realnum_expr expr-1.228\
      {i2=-9223372036854775807, i1=0} {i1-i2}      9223372036854775807
  test_realnum_expr expr-1.229\
      {i2=-9223372036854775807, i1=1} {i1-i2}      9.22337203685478e+18
  test_realnum_expr expr-1.230\
      {i1=-9223372036854775807, i2=1} {i1-i2}    -9223372036854775808
  test_realnum_expr expr-1.231\
      {i1=-9223372036854775807, i2=2} {i1-i2}    -9.22337203685478e+18
  test_realnum_expr expr-1.232\
      {i1=-9223372036854775807, i2=100000} {i1-i2} -9.22337203685488e+18
  test_realnum_expr expr-1.233\
      {i1=-9223372036854775808, i2=0} {i1-i2}     -9223372036854775808
  test_realnum_expr expr-1.234\
      {i1=-9223372036854775808, i2=1} {i1-i2}    -9.22337203685478e+18
  test_realnum_expr expr-1.235\
      {i2=9223372036854775807, i1=-1} {i1-i2}    -9223372036854775808
  test_realnum_expr expr-1.236\
      {i2=9223372036854775807, i1=-2} {i1-i2}    -9.22337203685478e+18
  test_realnum_expr expr-1.237\
      {i2=9223372036854775807, i1=-100000} {i1-i2} -9.22337203685488e+18
  test_realnum_expr expr-1.238\
      {i2=9223372036854775807, i1=0} {i1-i2}     -9223372036854775807
  test_realnum_expr expr-1.239\
      {i2=9223372036854775807, i1=-1} {i1-i2}    -9223372036854775808

  test_realnum_expr expr-1.250\
      {i1=4294967296, i2=2147483648} {i1*i2}      9.22337203685478e+18
  test_realnum_expr expr-1.251\
      {i1=4294967296, i2=2147483647} {i1*i2}      9223372032559808512
  test_realnum_expr expr-1.252\
      {i1=-4294967296, i2=2147483648} {i1*i2}     -9223372036854775808
  test_realnum_expr expr-1.253\
      {i1=-4294967296, i2=2147483647} {i1*i2}     -9223372032559808512
  test_realnum_expr expr-1.254\
      {i1=4294967296, i2=-2147483648} {i1*i2}     -9223372036854775808
  test_realnum_expr expr-1.255\
      {i1=4294967296, i2=-2147483647} {i1*i2}     -9223372032559808512
  test_realnum_expr expr-1.256\
      {i1=-4294967296, i2=-2147483648} {i1*i2}    9.22337203685478e+18
  test_realnum_expr expr-1.257\
      {i1=-4294967296, i2=-2147483647} {i1*i2}    9223372032559808512

}}

ifcapable floatingpoint {
  test_expr expr-2.1 {r1=1.23, r2=2.34} {r1+r2} 3.57
  test_expr expr-2.2 {r1=1.23, r2=2.34} {r1-r2} -1.11
................................................................................
do_test expr-12.2 {
  catchsql {
    SELECT (CASE WHEN a>4 THEN 1 ELSE 0) FROM test1;
  }
} {1 {near ")": syntax error}}

ifcapable floatingpoint {
  do_realnum_test expr-13.1 {
    execsql {
      SELECT 12345678901234567890;
    }
  } {1.23456789012346e+19}
}

# Implicit String->Integer conversion is used when possible.
................................................................................
    }
  } {9223372036854775807}
}

# If the value is too large, use String->Float conversion.
#
ifcapable floatingpoint {
  do_realnum_test expr-13.4 {
    execsql {
      SELECT 0+'9223372036854775808'
    }
  } {9.22337203685478e+18}
  do_realnum_test expr-13.5 {
    execsql {
      SELECT '9223372036854775808'+0
    }
  } {9.22337203685478e+18}
}

# Use String->float conversion if the value is explicitly a floating
# point value.
#
do_realnum_test expr-13.6 {
  execsql {
    SELECT 0+'9223372036854775807.0'
  }
} {9.22337203685478e+18}
do_realnum_test expr-13.7 {
  execsql {
    SELECT '9223372036854775807.0'+0
  }
} {9.22337203685478e+18}


finish_test

Changes to test/nan.test.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
...
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
...
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
  set ::STMT [sqlite3_prepare db "INSERT INTO t1 VALUES(?)" -1 TAIL]
  sqlite3_bind_double $::STMT 1 NaN
  sqlite3_step $::STMT
  sqlite3_reset $::STMT
  db eval {SELECT x, typeof(x) FROM t1}
} {{} null}
if {$tcl_platform(platform) != "symbian"} {
  do_test nan-1.1.2 {
    sqlite3_bind_double $::STMT 1 +Inf
    sqlite3_step $::STMT
    sqlite3_reset $::STMT
    db eval {SELECT x, typeof(x) FROM t1}
  } {{} null inf real}
  do_test nan-1.1.3 {
    sqlite3_bind_double $::STMT 1 -Inf
    sqlite3_step $::STMT
    sqlite3_reset $::STMT
    db eval {SELECT x, typeof(x) FROM t1}
  } {{} null inf real -inf real}
  do_test nan-1.1.4 {
    sqlite3_bind_double $::STMT 1 -NaN
    sqlite3_step $::STMT
    sqlite3_reset $::STMT
    db eval {SELECT x, typeof(x) FROM t1}
  } {{} null inf real -inf real {} null}
  do_test nan-1.1.5 {
    sqlite3_bind_double $::STMT 1 NaN0
    sqlite3_step $::STMT
    sqlite3_reset $::STMT
    db eval {SELECT x, typeof(x) FROM t1}
  } {{} null inf real -inf real {} null {} null}
  do_test nan-1.1.6 {
    sqlite3_bind_double $::STMT 1 -NaN0
    sqlite3_step $::STMT
    sqlite3_reset $::STMT
    db eval {SELECT x, typeof(x) FROM t1}
  } {{} null inf real -inf real {} null {} null {} null}
  do_test nan-1.1.7 {
    db eval {
................................................................................
  db eval {SELECT x, typeof(x) FROM t1}
} {1e+308 real}

if {$tcl_platform(platform) != "symbian"} {
  # Do not run these tests on Symbian, as the Tcl port doesn't like to
  # convert from floating point value "-inf" to a string.
  #
  do_test nan-4.7 {
    db eval {DELETE FROM t1}
    db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)"
    db eval {SELECT x, typeof(x) FROM t1}
  } {inf real}
  do_test nan-4.8 {
    db eval {DELETE FROM t1}
    db eval "INSERT INTO t1 VALUES(-[string repeat 9 309].0)"
    db eval {SELECT x, typeof(x) FROM t1}
  } {-inf real}
}
do_test nan-4.9 {
  db eval {DELETE FROM t1}
................................................................................
  db eval {DELETE FROM t1}
  set small \
      -[string repeat 0 10000].[string repeat 0 323][string repeat 9 10000]
  db eval "INSERT INTO t1 VALUES($small)"
  db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
} {-9.88131291682493e-324 real}

do_test nan-4.20 {
  db eval {DELETE FROM t1}
  set big [string repeat 9 10000].0e-9000
  db eval "INSERT INTO t1 VALUES($big)"
  db eval {SELECT x, typeof(x) FROM t1}
} {inf real}



finish_test







|





|





|





|





|







 







|




|







 







|









38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
...
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
...
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
  set ::STMT [sqlite3_prepare db "INSERT INTO t1 VALUES(?)" -1 TAIL]
  sqlite3_bind_double $::STMT 1 NaN
  sqlite3_step $::STMT
  sqlite3_reset $::STMT
  db eval {SELECT x, typeof(x) FROM t1}
} {{} null}
if {$tcl_platform(platform) != "symbian"} {
  do_realnum_test nan-1.1.2 {
    sqlite3_bind_double $::STMT 1 +Inf
    sqlite3_step $::STMT
    sqlite3_reset $::STMT
    db eval {SELECT x, typeof(x) FROM t1}
  } {{} null inf real}
  do_realnum_test nan-1.1.3 {
    sqlite3_bind_double $::STMT 1 -Inf
    sqlite3_step $::STMT
    sqlite3_reset $::STMT
    db eval {SELECT x, typeof(x) FROM t1}
  } {{} null inf real -inf real}
  do_realnum_test nan-1.1.4 {
    sqlite3_bind_double $::STMT 1 -NaN
    sqlite3_step $::STMT
    sqlite3_reset $::STMT
    db eval {SELECT x, typeof(x) FROM t1}
  } {{} null inf real -inf real {} null}
  do_realnum_test nan-1.1.5 {
    sqlite3_bind_double $::STMT 1 NaN0
    sqlite3_step $::STMT
    sqlite3_reset $::STMT
    db eval {SELECT x, typeof(x) FROM t1}
  } {{} null inf real -inf real {} null {} null}
  do_realnum_test nan-1.1.6 {
    sqlite3_bind_double $::STMT 1 -NaN0
    sqlite3_step $::STMT
    sqlite3_reset $::STMT
    db eval {SELECT x, typeof(x) FROM t1}
  } {{} null inf real -inf real {} null {} null {} null}
  do_test nan-1.1.7 {
    db eval {
................................................................................
  db eval {SELECT x, typeof(x) FROM t1}
} {1e+308 real}

if {$tcl_platform(platform) != "symbian"} {
  # Do not run these tests on Symbian, as the Tcl port doesn't like to
  # convert from floating point value "-inf" to a string.
  #
  do_realnum_test nan-4.7 {
    db eval {DELETE FROM t1}
    db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)"
    db eval {SELECT x, typeof(x) FROM t1}
  } {inf real}
  do_realnum_test nan-4.8 {
    db eval {DELETE FROM t1}
    db eval "INSERT INTO t1 VALUES(-[string repeat 9 309].0)"
    db eval {SELECT x, typeof(x) FROM t1}
  } {-inf real}
}
do_test nan-4.9 {
  db eval {DELETE FROM t1}
................................................................................
  db eval {DELETE FROM t1}
  set small \
      -[string repeat 0 10000].[string repeat 0 323][string repeat 9 10000]
  db eval "INSERT INTO t1 VALUES($small)"
  db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
} {-9.88131291682493e-324 real}

do_realnum_test nan-4.20 {
  db eval {DELETE FROM t1}
  set big [string repeat 9 10000].0e-9000
  db eval "INSERT INTO t1 VALUES($big)"
  db eval {SELECT x, typeof(x) FROM t1}
} {inf real}



finish_test

Changes to test/pager1.test.

1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
....
2377
2378
2379
2380
2381
2382
2383

2384
2385
2386
2387
2388
2389
2390
....
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
#-------------------------------------------------------------------------
# Check that it is not possible to open a database file if the full path
# to the associated journal file will be longer than sqlite3_vfs.mxPathname.
#
testvfs tv -default 1
tv script xOpenCb
tv filter xOpen
proc xOpenCb {method filename} {
  set ::file_len [string length $filename]
}
sqlite3 db test.db
db close
tv delete

for {set ii [expr $::file_len-5]} {$ii < [expr $::file_len+20]} {incr ii} {
................................................................................
} {exclusive 0 main reserved temp closed}

#-------------------------------------------------------------------------
# Test that if the "page-size" field in a journal-header is 0, the journal
# file can still be rolled back. This is required for backward compatibility -
# versions of SQLite prior to 3.5.8 always set this field to zero.
#

do_test pager1-31.1 {
  faultsim_delete_and_reopen
  execsql {
    PRAGMA cache_size = 10;
    PRAGMA page_size = 1024;
    CREATE TABLE t1(x, y, UNIQUE(x, y));
    INSERT INTO t1 VALUES(randomblob(1500), randomblob(1500));
................................................................................
  file copy test.db test.db2
  file copy test.db-journal test.db2-journal
  
  hexio_write test.db2-journal 24 00000000
  sqlite3 db2 test.db2
  execsql { PRAGMA integrity_check } db2
} {ok}



finish_test







|







 







>







 







|



1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
....
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
....
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
#-------------------------------------------------------------------------
# Check that it is not possible to open a database file if the full path
# to the associated journal file will be longer than sqlite3_vfs.mxPathname.
#
testvfs tv -default 1
tv script xOpenCb
tv filter xOpen
proc xOpenCb {method filename args} {
  set ::file_len [string length $filename]
}
sqlite3 db test.db
db close
tv delete

for {set ii [expr $::file_len-5]} {$ii < [expr $::file_len+20]} {incr ii} {
................................................................................
} {exclusive 0 main reserved temp closed}

#-------------------------------------------------------------------------
# Test that if the "page-size" field in a journal-header is 0, the journal
# file can still be rolled back. This is required for backward compatibility -
# versions of SQLite prior to 3.5.8 always set this field to zero.
#
if {$tcl_platform(platform)=="unix"} {
do_test pager1-31.1 {
  faultsim_delete_and_reopen
  execsql {
    PRAGMA cache_size = 10;
    PRAGMA page_size = 1024;
    CREATE TABLE t1(x, y, UNIQUE(x, y));
    INSERT INTO t1 VALUES(randomblob(1500), randomblob(1500));
................................................................................
  file copy test.db test.db2
  file copy test.db-journal test.db2-journal
  
  hexio_write test.db2-journal 24 00000000
  sqlite3 db2 test.db2
  execsql { PRAGMA integrity_check } db2
} {ok}
}


finish_test

Changes to test/tester.tcl.

349
350
351
352
353
354
355









356
357
358
359
360
361
362
    puts "\nExpected: \[$expected\]\n     Got: \[$result\]"
    fail_test $name
  } else {
    puts " Ok"
  }
  flush stdout
}










proc fix_testname {varname} {
  upvar $varname testname
  if {[info exists ::testprefix] 
   && [string is digit [string range $testname 0 0]]
  } {
    set testname "${::testprefix}-$testname"







>
>
>
>
>
>
>
>
>







349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
    puts "\nExpected: \[$expected\]\n     Got: \[$result\]"
    fail_test $name
  } else {
    puts " Ok"
  }
  flush stdout
}

proc realnum_normalize {r} {
  string map {1.#INF inf} [regsub -all {(e[+-])0+} $r {\1}]
}
proc do_realnum_test {name cmd expected} {
  uplevel [list do_test $name [
    subst -nocommands { realnum_normalize [ $cmd ] }
  ] [realnum_normalize $expected]]
}

proc fix_testname {varname} {
  upvar $varname testname
  if {[info exists ::testprefix] 
   && [string is digit [string range $testname 0 0]]
  } {
    set testname "${::testprefix}-$testname"

Changes to test/tkt3838.test.

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
source $testdir/tester.tcl

ifcapable !altertable {
  finish_test
  return
}

do_test tkt3838-1.1 {
  db eval {
    PRAGMA encoding=UTF16;
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES(1);
    ALTER TABLE t1 ADD COLUMN b INTEGER DEFAULT '999';
    ALTER TABLE t1 ADD COLUMN c REAL DEFAULT '9e99';
    ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'xyzzy';
    UPDATE t1 SET x=x+1;
    SELECT * FROM t1;
  }
} {2 999 9e+99 xyzzy}

finish_test







|













21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
source $testdir/tester.tcl

ifcapable !altertable {
  finish_test
  return
}

do_realnum_test tkt3838-1.1 {
  db eval {
    PRAGMA encoding=UTF16;
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES(1);
    ALTER TABLE t1 ADD COLUMN b INTEGER DEFAULT '999';
    ALTER TABLE t1 ADD COLUMN c REAL DEFAULT '9e99';
    ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT 'xyzzy';
    UPDATE t1 SET x=x+1;
    SELECT * FROM t1;
  }
} {2 999 9e+99 xyzzy}

finish_test

Changes to test/tkt3922.test.

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    execsql {
      CREATE TABLE t1(a NUMBER);
      INSERT INTO t1 VALUES('-1');
      SELECT a, typeof(a) FROM t1;
    }
  } {-1 integer}
}
do_test tkt3922.2 {
  execsql {
    DELETE FROM t1;
    INSERT INTO t1 VALUES('-9223372036854775809');
    SELECT a, typeof(a) FROM t1;
  }
} {-9.22337203685478e+18 real}
do_test tkt3922.3 {
  execsql {
    DELETE FROM t1;
    INSERT INTO t1 VALUES('-9223372036854776832');
    SELECT a, typeof(a) FROM t1;
  }
} {-9.22337203685478e+18 real}
do_test tkt3922.4 {
  execsql {
    DELETE FROM t1;
    INSERT INTO t1 VALUES('-9223372036854776833');
    SELECT a, typeof(a) FROM t1;
  }
} {-9.22337203685478e+18 real}
if {[working_64bit_int]} {
................................................................................
    execsql {
      DELETE FROM t1;
      INSERT INTO t1 VALUES('1');
      SELECT a, typeof(a) FROM t1;
    }
  } {1 integer}
}
do_test tkt3922.6 {
  execsql {
    DELETE FROM t1;
    INSERT INTO t1 VALUES('9223372036854775808');
    SELECT a, typeof(a) FROM t1;
  }
} {9.22337203685478e+18 real}

finish_test







|






|






|







 







|








32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    execsql {
      CREATE TABLE t1(a NUMBER);
      INSERT INTO t1 VALUES('-1');
      SELECT a, typeof(a) FROM t1;
    }
  } {-1 integer}
}
do_realnum_test tkt3922.2 {
  execsql {
    DELETE FROM t1;
    INSERT INTO t1 VALUES('-9223372036854775809');
    SELECT a, typeof(a) FROM t1;
  }
} {-9.22337203685478e+18 real}
do_realnum_test tkt3922.3 {
  execsql {
    DELETE FROM t1;
    INSERT INTO t1 VALUES('-9223372036854776832');
    SELECT a, typeof(a) FROM t1;
  }
} {-9.22337203685478e+18 real}
do_realnum_test tkt3922.4 {
  execsql {
    DELETE FROM t1;
    INSERT INTO t1 VALUES('-9223372036854776833');
    SELECT a, typeof(a) FROM t1;
  }
} {-9.22337203685478e+18 real}
if {[working_64bit_int]} {
................................................................................
    execsql {
      DELETE FROM t1;
      INSERT INTO t1 VALUES('1');
      SELECT a, typeof(a) FROM t1;
    }
  } {1 integer}
}
do_realnum_test tkt3922.6 {
  execsql {
    DELETE FROM t1;
    INSERT INTO t1 VALUES('9223372036854775808');
    SELECT a, typeof(a) FROM t1;
  }
} {9.22337203685478e+18 real}

finish_test