SQLite

Check-in [d0fbe779]
Login

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

Overview
Comment:Tweaks to the func4.test test module (which tests the rarely used totype.c extension) so that it works on i586 compiled using gcc-13 with -O0. Details at forum post 0a7553b0f734c033.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d0fbe779bc2460e120da4f39063a9f4121c700f0b86d85f4311715b1366c3515
User & Date: drh 2024-03-15 13:16:13
Context
2024-03-15
17:04
Fix (totally harmless) memory leaks in Lemon to avoid warnings during ASAN builds. (check-in: ce009205 user: drh tags: trunk)
13:16
Tweaks to the func4.test test module (which tests the rarely used totype.c extension) so that it works on i586 compiled using gcc-13 with -O0. Details at forum post 0a7553b0f734c033. (check-in: d0fbe779 user: drh tags: trunk)
2024-03-14
13:18
JS: remove an unused function argument and some debug-related comments. No functional changes. (check-in: f1570943 user: stephan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/func4.test.

1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
20
21
22
23
24
25














26
27
28
29
30
31
32
# 2013 March 10
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The focus of
# this file is testing the tointeger() and toreal() functions.



#
# Several of the toreal() tests are disabled on platforms where floating
# point precision is not high enough to represent their constant integer
# expression arguments as double precision floating point values.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set saved_tcl_precision $tcl_precision
set tcl_precision 0
load_static_extension db totype

set highPrecision(1) [expr \
    {[db eval {SELECT tointeger(9223372036854775807 + 1);}] eq {{}}}]















do_execsql_test func4-1.1 {
  SELECT tointeger(NULL);
} {{}}
do_execsql_test func4-1.2 {
  SELECT tointeger('');
} {{}}
|










|
>
>
>













>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# 2023-03-10
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The focus of
# this file is testing the tointeger() and toreal() functions that are
# part of the "totype.c" extension.  This file does not test the core
# SQLite library.  Failures of tests in this file are related to the
# ext/misc/totype.c extension.
#
# Several of the toreal() tests are disabled on platforms where floating
# point precision is not high enough to represent their constant integer
# expression arguments as double precision floating point values.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set saved_tcl_precision $tcl_precision
set tcl_precision 0
load_static_extension db totype

set highPrecision(1) [expr \
    {[db eval {SELECT tointeger(9223372036854775807 + 1);}] eq {{}}}]
set highPrecision(2) [expr \
    {[db eval {SELECT toreal(-9223372036854775808 + 1);}] eq {{}}}]

# highPrecision(3) is only known to be false on i586 with gcc-13 and -O2.
# It is true on the exact same platform with -O0.  Both results seem
# reasonable, so we'll just very the expectation accordingly.
#
set highPrecision(3) [expr \
    {[db eval {SELECT toreal(9007199254740992 + 1);}] eq {{}}}]

if {!$highPrecision(1) || !$highPrecision(2) || !$highPrecision(3)} {
  puts "NOTICE: use_long_double: [use_long_double] \
        highPrecision: $highPrecision(1) $highPrecision(2) $highPrecision(3)"
}

do_execsql_test func4-1.1 {
  SELECT tointeger(NULL);
} {{}}
do_execsql_test func4-1.2 {
  SELECT tointeger('');
} {{}}
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
  SELECT tointeger(18446744073709551616);
} {{}}
do_execsql_test func4-1.55 {
  SELECT tointeger(18446744073709551616 + 1);
} {{}}

ifcapable floatingpoint {
  set highPrecision(2) [expr \
      {[db eval {SELECT toreal(-9223372036854775808 + 1);}] eq {{}}}]

  do_execsql_test func4-2.1 {
    SELECT toreal(NULL);
  } {{}}
  do_execsql_test func4-2.2 {
    SELECT toreal('');
  } {{}}







<
<







208
209
210
211
212
213
214


215
216
217
218
219
220
221
  SELECT tointeger(18446744073709551616);
} {{}}
do_execsql_test func4-1.55 {
  SELECT tointeger(18446744073709551616 + 1);
} {{}}

ifcapable floatingpoint {



  do_execsql_test func4-2.1 {
    SELECT toreal(NULL);
  } {{}}
  do_execsql_test func4-2.2 {
    SELECT toreal('');
  } {{}}
337
338
339
340
341
342
343
344
345
346
347




348
349
350
351
352
353
354
  } {4503599627370497.0}
  do_execsql_test func4-2.44 {
    SELECT toreal(9007199254740992 - 1);
  } {9007199254740991.0}
  do_execsql_test func4-2.45 {
    SELECT toreal(9007199254740992);
  } {9007199254740992.0}
  if {$highPrecision(2)} {
    do_execsql_test func4-2.46 {
      SELECT toreal(9007199254740992 + 1);
    } {{}}




  }
  do_execsql_test func4-2.47 {
    SELECT toreal(9007199254740992 + 2);
  } {9007199254740994.0}
  do_execsql_test func4-2.48 {
    SELECT toreal(tointeger(9223372036854775808) - 1);
  } {{}}







|



>
>
>
>







352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
  } {4503599627370497.0}
  do_execsql_test func4-2.44 {
    SELECT toreal(9007199254740992 - 1);
  } {9007199254740991.0}
  do_execsql_test func4-2.45 {
    SELECT toreal(9007199254740992);
  } {9007199254740992.0}
  if {$highPrecision(3)} {
    do_execsql_test func4-2.46 {
      SELECT toreal(9007199254740992 + 1);
    } {{}}
  } else {
    do_execsql_test func4-2.46 {
      SELECT toreal(9007199254740992 + 1);
    } {9007199254740992.0}
  }
  do_execsql_test func4-2.47 {
    SELECT toreal(9007199254740992 + 2);
  } {9007199254740994.0}
  do_execsql_test func4-2.48 {
    SELECT toreal(tointeger(9223372036854775808) - 1);
  } {{}}
622
623
624
625
626
627
628
629
630
631
632




633
634
635
636
637
638
639
  } {4503599627370497}
  do_execsql_test func4-5.21 {
    SELECT tointeger(toreal(9007199254740992 - 1));
  } {9007199254740991}
  do_execsql_test func4-5.22 {
    SELECT tointeger(toreal(9007199254740992));
  } {9007199254740992}
  if {$highPrecision(2)} {
    do_execsql_test func4-5.23 {
      SELECT tointeger(toreal(9007199254740992 + 1));
    } {{}}




  }
  do_execsql_test func4-5.24 {
    SELECT tointeger(toreal(9007199254740992 + 2));
  } {9007199254740994}
  if {$highPrecision(1)} {
    do_execsql_test func4-5.25 {
      SELECT tointeger(toreal(9223372036854775808 - 1));







|



>
>
>
>







641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
  } {4503599627370497}
  do_execsql_test func4-5.21 {
    SELECT tointeger(toreal(9007199254740992 - 1));
  } {9007199254740991}
  do_execsql_test func4-5.22 {
    SELECT tointeger(toreal(9007199254740992));
  } {9007199254740992}
  if {$highPrecision(3)} {
    do_execsql_test func4-5.23 {
      SELECT tointeger(toreal(9007199254740992 + 1));
    } {{}}
  } else {
    do_execsql_test func4-5.23 {
      SELECT tointeger(toreal(9007199254740992 + 1));
    } {9007199254740992}
  }
  do_execsql_test func4-5.24 {
    SELECT tointeger(toreal(9007199254740992 + 2));
  } {9007199254740994}
  if {$highPrecision(1)} {
    do_execsql_test func4-5.25 {
      SELECT tointeger(toreal(9223372036854775808 - 1));