[Issue 19023] New: findSplitBefore and findSplitAfter give wrong bool result

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 24 20:57:07 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19023

          Issue ID: 19023
           Summary: findSplitBefore and findSplitAfter give wrong bool
                    result
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: ag0aep6g at gmail.com

Found while looking into issue 19020.

The results of findSplit, findSplitBefore, and findSplitAfter are all supposed
to convert to "true when the separating needle was found" [1]. But only
findSplit actually does. The other two misbehave:

----
import std.algorithm.searching: findSplitBefore, findSplitAfter;
void main()
{
    assert(![1, 2, 3].findSplitBefore([4])); /* fails; should pass */
    assert(![1, 2, 3].findSplitAfter([4])); /* fails; should pass */
}
----


[1] https://dlang.org/phobos/std_algorithm_searching.html#.findSplit

--


More information about the Digitalmars-d-bugs mailing list