Tk Library Source Code

View Ticket
Login
Ticket UUID: 722132
Title: struct prioqueue fails its testsuite
Type: Bug Version: None
Submitter: andreas_kupries Created on: 2003-04-15 22:06:50
Subsystem: struct :: prioqueue Assigned To: andreas_kupries
Priority: 8 Severity:
Status: Closed Last Modified: 2003-04-17 02:45:19
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2003-04-16 19:45:19
Description:
The newly added priority queue fails its testsuite.
User Comments: andreas_kupries added on 2003-04-17 02:45:19:
Logged In: YES 
user_id=75003

Accepted change and committed to head.

mic42 added on 2003-04-16 12:55:40:
Logged In: YES 
user_id=302287

Trivial bug in __elementcompare ( ">" should be "<")

This fixes it:

# ::struct::prioqueue::__elementcompare 
 #
 # Compare helper with the sort options. 
 #
 #
 
 proc ::struct::prioqueue::__elementcompare {prio newPrio
sortopt sortdir} {   
    if {[string equal $sortopt "-integer"] || [string equal
$sortopt "-real"]} {
        set result [expr {$prio < $newPrio}]
    } elseif {[string equal $sortopt "-ascii"]} {
        set result [expr {[string compare $prio $newPrio] < 0}]
    } elseif {[string equal $sortopt "-dictionary"]} {
        # need to use lsort to access -dictionary sorting
        set result [string equal $prio [lindex \
                    [lsort -increasing -dictionary [list
$prio $newPrio]] 0]] 
    }
    
    return [expr {[string equal $sortdir "-decreasing"] ?
$result : !$result}] 
 }

andreas_kupries added on 2003-04-16 05:06:50:

File Added - 47876: prioqueue.FAILED

Attachments: