/ Check-in [7c26c443]
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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7c26c443e7f6455ca7f11f640e42285b42d95c9ae5f2e19e9c066d6d9cdcceb2
User & Date: dan 2018-07-10 18:50:01
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: a7cdc5bc user: drh tags: trunk
18:50
Modify tests in window3.test to be tolerant of rounding errors when comparing floating point values. check-in: 7c26c443 user: dan tags: trunk
17:26
Fix a problem with using scalar sub-selects in window function queries. check-in: 687fe532 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to test/pg_common.tcl.

    67     67     puts $::fd ""
    68     68   }
    69     69   
    70     70   # Same as [execsql_test], except coerce all results to floating point values
    71     71   # with two decimal points.
    72     72   #
    73     73   proc execsql_float_test {tn sql} {
    74         -  set F "%.2f"
           74  +  set F "%.4f"
           75  +  set T 0.0001
    75     76     set res [execsql $sql]
    76     77     set res2 [list]
    77     78     foreach r $res { 
    78     79       if {$r != ""} { set r [format $F $r] }
    79     80       lappend res2 $r
    80     81     }
    81     82   
    82         -  puts $::fd "do_test $tn {"
    83         -  puts $::fd "  set myres {}"
    84         -  puts $::fd "  foreach r \[db eval {[string trim $sql]}\] {"
    85         -  puts $::fd "    lappend myres \[format $F \[set r\]\]"
    86         -  puts $::fd "  }"
    87         -  puts $::fd "  set myres"
    88         -  puts $::fd "} {$res2}"
    89         -  puts $::fd ""
           83  +  set sql [string trim $sql]
           84  +puts $::fd [subst -nocommands {
           85  +do_test $tn {
           86  +  set myres {}
           87  +  foreach r [db eval {$sql}] {
           88  +    lappend myres [format $F [set r]]
           89  +  }
           90  +  set res2 {$res2}
           91  +  foreach r [set myres] r2 [set res2] {
           92  +    if {[set r]<([set r2]-$T) || [set r]>([set r2]+$T)} {
           93  +      error "list element [set i] does not match: got=[set r] expected=[set r2]"
           94  +    }
           95  +  }
           96  +  set {} {}
           97  +} {}
           98  +}]
    90     99   }
    91    100   
    92    101   proc start_test {name date} {
    93    102     set dir [file dirname $::argv0]
    94    103     set output [file join $dir $name.test]
    95    104     set ::fd [open $output w]
    96    105   puts $::fd [string trimleft "

Changes to test/window3.test.

cannot compute difference between binary files