www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19023] New: findSplitBefore and findSplitAfter give wrong


          Issue ID: 19023
           Summary: findSplitBefore and findSplitAfter give wrong bool
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: ag0aep6g 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

Jun 24 2018