SQLite

Check-in [7c26c443e7]
Login

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

Overview
Comment:Modify tests in window3.test to be tolerant of rounding errors when comparing floating point values.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7c26c443e7f6455ca7f11f640e42285b42d95c9ae5f2e19e9c066d6d9cdcceb2
User & Date: dan 2018-07-10 18:50:01.938
Context
2018-07-10
19:48
Identify Select objects within a single statement using small sequential integers rather than "0x%p". This is more readable and yields the same result on successive runs. (check-in: a7cdc5bc85 user: drh tags: trunk)
18:50
Modify tests in window3.test to be tolerant of rounding errors when comparing floating point values. (check-in: 7c26c443e7 user: dan tags: trunk)
17:26
Fix a problem with using scalar sub-selects in window function queries. (check-in: 687fe532c2 user: dan tags: trunk)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to test/pg_common.tcl.
67
68
69
70
71
72
73
74

75
76
77
78
79
80
81


82
83
84
85
86


87




88
89

90
91
92
93
94
95
96
  puts $::fd ""
}

# Same as [execsql_test], except coerce all results to floating point values
# with two decimal points.
#
proc execsql_float_test {tn sql} {
  set F "%.2f"

  set res [execsql $sql]
  set res2 [list]
  foreach r $res { 
    if {$r != ""} { set r [format $F $r] }
    lappend res2 $r
  }



  puts $::fd "do_test $tn {"
  puts $::fd "  set myres {}"
  puts $::fd "  foreach r \[db eval {[string trim $sql]}\] {"
  puts $::fd "    lappend myres \[format $F \[set r\]\]"
  puts $::fd "  }"


  puts $::fd "  set myres"




  puts $::fd "} {$res2}"
  puts $::fd ""

}

proc start_test {name date} {
  set dir [file dirname $::argv0]
  set output [file join $dir $name.test]
  set ::fd [open $output w]
puts $::fd [string trimleft "







|
>







>
>
|
|
|
|
<
>
>
|
>
>
>
>
|
|
>







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  puts $::fd ""
}

# Same as [execsql_test], except coerce all results to floating point values
# with two decimal points.
#
proc execsql_float_test {tn sql} {
  set F "%.4f"
  set T 0.0001
  set res [execsql $sql]
  set res2 [list]
  foreach r $res { 
    if {$r != ""} { set r [format $F $r] }
    lappend res2 $r
  }

  set sql [string trim $sql]
puts $::fd [subst -nocommands {
do_test $tn {
  set myres {}
  foreach r [db eval {$sql}] {
    lappend myres [format $F [set r]]

  }
  set res2 {$res2}
  foreach r [set myres] r2 [set res2] {
    if {[set r]<([set r2]-$T) || [set r]>([set r2]+$T)} {
      error "list element [set i] does not match: got=[set r] expected=[set r2]"
    }
  }
  set {} {}
} {}
}]
}

proc start_test {name date} {
  set dir [file dirname $::argv0]
  set output [file join $dir $name.test]
  set ::fd [open $output w]
puts $::fd [string trimleft "
Changes to test/window3.test.

cannot compute difference between binary files