www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7287] New: std.container.BinaryHeap example fails

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7287

           Summary: std.container.BinaryHeap example fails
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: mailme+d nilsb.dyndns.org



The example from http://www.dlang.org/phobos/std_container#BinaryHeap fails:
---
import std.algorithm, std.container;
void main() {
    // Example from "Introduction to Algorithms" Cormen et al, p 146
    int[] a = [ 4, 1, 3, 2, 16, 9, 10, 14, 8, 7 ];
    auto h = heapify(a);
    // largest element
    assert(h.front == 16);
    // a has the heap property
    assert(equal(a, [ 16, 14, 10, 9, 8, 7, 4, 3, 2, 1 ]));
}
---
core.exception.AssertError test(9): Assertion failure

Tested with dmd 2.057 and 2.058head.

Interestingly, the corresponding unit test in container.d differs slightly from
the example (and passes).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 12 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7287


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com
         OS/Version|Linux                       |All



PDT ---
Fails also on Win32 2.059

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7287


Mariusz GliwiƄski <alienballance gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alienballance gmail.com



16:42:50 PST ---
same on dmd 2.060 (linux x64)
http://dpaste.dzfl.pl/1bd35a26

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 28 2012