mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 23:50:31 +03:00
Merge pull request #7441 from Geod24/bugzilla-links
Change all bug ID to links merged-on-behalf-of: Vladimir Panteleev <CyberShadow@users.noreply.github.com>
This commit is contained in:
commit
ffca395ed2
69 changed files with 1248 additions and 912 deletions
|
@ -804,9 +804,10 @@ pure @safe unittest
|
|||
assert(result > 0);
|
||||
}
|
||||
|
||||
// cmp for string with custom predicate fails if distinct chars can compare equal
|
||||
// https://issues.dlang.org/show_bug.cgi?id=18286
|
||||
@nogc nothrow pure @safe unittest
|
||||
{
|
||||
// Issue 18286: cmp for string with custom predicate fails if distinct chars can compare equal
|
||||
static bool ltCi(dchar a, dchar b)// less than, case insensitive
|
||||
{
|
||||
import std.ascii : toUpper;
|
||||
|
@ -819,9 +820,10 @@ pure @safe unittest
|
|||
static assert(cmp!ltCi("apple", "APPLE") == 0);
|
||||
}
|
||||
|
||||
// for non-string ranges check that opCmp is evaluated only once per pair.
|
||||
// https://issues.dlang.org/show_bug.cgi?id=18280
|
||||
@nogc nothrow @safe unittest
|
||||
{
|
||||
// Issue 18280: for non-string ranges check that opCmp is evaluated only once per pair.
|
||||
static int ctr = 0;
|
||||
struct S
|
||||
{
|
||||
|
|
|
@ -207,7 +207,7 @@ if (isBidirectionalRange!Range)
|
|||
assert(counter == iota(-4, 5).length);
|
||||
}
|
||||
|
||||
// issue 15891
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15891
|
||||
@safe pure unittest
|
||||
{
|
||||
assert([1].map!(x=>[x].map!(y=>y)).cache.front.front == 1);
|
||||
|
@ -356,7 +356,7 @@ private struct _Cache(R, bool bidir)
|
|||
else
|
||||
{
|
||||
// needed, because the compiler cannot deduce, that 'caches' is initialized
|
||||
// see issue 15891
|
||||
// see https://issues.dlang.org/show_bug.cgi?id=15891
|
||||
caches[0] = UE.init;
|
||||
static if (bidir)
|
||||
caches[1] = UE.init;
|
||||
|
@ -395,7 +395,7 @@ private struct _Cache(R, bool bidir)
|
|||
caches[0] = source.front;
|
||||
else
|
||||
{
|
||||
// see issue 15891
|
||||
// see https://issues.dlang.org/show_bug.cgi?id=15891
|
||||
caches[0] = UE.init;
|
||||
static if (bidir)
|
||||
caches[1] = UE.init;
|
||||
|
@ -409,7 +409,7 @@ private struct _Cache(R, bool bidir)
|
|||
caches[1] = source.back;
|
||||
else
|
||||
{
|
||||
// see issue 15891
|
||||
// see https://issues.dlang.org/show_bug.cgi?id=15891
|
||||
caches[0] = UE.init;
|
||||
caches[1] = UE.init;
|
||||
}
|
||||
|
@ -502,7 +502,9 @@ if (fun.length >= 1)
|
|||
alias _funs = staticMap!(unaryFun, fun);
|
||||
alias _fun = adjoin!_funs;
|
||||
|
||||
// Once DMD issue #5710 is fixed, this validation loop can be moved into a template.
|
||||
// Once https://issues.dlang.org/show_bug.cgi?id=5710 is fixed
|
||||
// accross all compilers (as of 2020-04, it wasn't fixed in LDC and GDC),
|
||||
// this validation loop can be moved into a template.
|
||||
foreach (f; _funs)
|
||||
{
|
||||
static assert(!is(typeof(f(RE.init)) == void),
|
||||
|
@ -514,7 +516,8 @@ if (fun.length >= 1)
|
|||
alias _fun = unaryFun!fun;
|
||||
alias _funs = AliasSeq!(_fun);
|
||||
|
||||
// Do the validation separately for single parameters due to DMD issue #15777.
|
||||
// Do the validation separately for single parameters due to
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15777.
|
||||
static assert(!is(typeof(_fun(RE.init)) == void),
|
||||
"Mapping function(s) must not return void: " ~ _funs.stringof);
|
||||
}
|
||||
|
@ -565,10 +568,9 @@ it separately:
|
|||
assert(equal(stringize([ 1, 2, 3, 4 ]), [ "1", "2", "3", "4" ]));
|
||||
}
|
||||
|
||||
// Verify workaround for https://issues.dlang.org/show_bug.cgi?id=15777
|
||||
@safe unittest
|
||||
{
|
||||
// Verify workaround for DMD #15777
|
||||
|
||||
import std.algorithm.mutation, std.string;
|
||||
auto foo(string[] args)
|
||||
{
|
||||
|
@ -805,7 +807,7 @@ private struct MapResult(alias fun, Range)
|
|||
assert(equal(ms2[0 .. 2], "日本"w));
|
||||
assert(equal(ms3[0 .. 2], "HE"));
|
||||
|
||||
// Issue 5753
|
||||
// https://issues.dlang.org/show_bug.cgi?id=5753
|
||||
static void voidFun(int) {}
|
||||
static int nonvoidFun(int) { return 0; }
|
||||
static assert(!__traits(compiles, map!voidFun([1])));
|
||||
|
@ -814,7 +816,7 @@ private struct MapResult(alias fun, Range)
|
|||
static assert(!__traits(compiles, map!(voidFun, nonvoidFun)([1])));
|
||||
static assert(!__traits(compiles, map!(a => voidFun(a))([1])));
|
||||
|
||||
// Phobos issue #15480
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15480
|
||||
auto dd = map!(z => z * z, c => c * c * c)([ 1, 2, 3, 4 ]);
|
||||
assert(dd[0] == tuple(1, 1));
|
||||
assert(dd[1] == tuple(4, 8));
|
||||
|
@ -836,7 +838,7 @@ private struct MapResult(alias fun, Range)
|
|||
{
|
||||
import std.range : iota;
|
||||
|
||||
// Issue #10130 - map of iota with const step.
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10130 - map of iota with const step.
|
||||
const step = 2;
|
||||
assert(map!(i => i)(iota(0, 10, step)).walkLength == 5);
|
||||
|
||||
|
@ -1142,7 +1144,8 @@ public:
|
|||
assert(b == [ 3, 4, 5 ]);
|
||||
}
|
||||
|
||||
// #15358: application of `each` with >2 args (opApply)
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15358
|
||||
// application of `each` with >2 args (opApply)
|
||||
@system unittest
|
||||
{
|
||||
import std.range : lockstep;
|
||||
|
@ -1157,7 +1160,8 @@ public:
|
|||
assert(c == [7,8,9]);
|
||||
}
|
||||
|
||||
// #15358: application of `each` with >2 args (range interface)
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15358
|
||||
// application of `each` with >2 args (range interface)
|
||||
@safe unittest
|
||||
{
|
||||
import std.range : zip;
|
||||
|
@ -1172,7 +1176,8 @@ public:
|
|||
assert(res == [9, 12, 15]);
|
||||
}
|
||||
|
||||
// #16255: `each` on opApply doesn't support ref
|
||||
// https://issues.dlang.org/show_bug.cgi?id=16255
|
||||
// `each` on opApply doesn't support ref
|
||||
@safe unittest
|
||||
{
|
||||
int[] dynamicArray = [1, 2, 3, 4, 5];
|
||||
|
@ -1188,7 +1193,8 @@ public:
|
|||
assert(staticArray == [3, 4, 5, 6, 7]);
|
||||
}
|
||||
|
||||
// #16255: `each` on opApply doesn't support ref
|
||||
// https://issues.dlang.org/show_bug.cgi?id=16255
|
||||
// `each` on opApply doesn't support ref
|
||||
@system unittest
|
||||
{
|
||||
struct S
|
||||
|
@ -1204,7 +1210,8 @@ public:
|
|||
assert(s.x == 2);
|
||||
}
|
||||
|
||||
// #15357: `each` should behave similar to foreach
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15357
|
||||
// `each` should behave similar to foreach
|
||||
/// `each` works with iterable objects which provide an index variable, along with each element
|
||||
@safe unittest
|
||||
{
|
||||
|
@ -1221,7 +1228,8 @@ public:
|
|||
assert(arr.sum == 4.iota.sum);
|
||||
}
|
||||
|
||||
// #15357: `each` should behave similar to foreach
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15357
|
||||
// `each` should behave similar to foreach
|
||||
@system unittest
|
||||
{
|
||||
import std.range : iota, lockstep;
|
||||
|
@ -1248,7 +1256,8 @@ public:
|
|||
assert(arrC.sum == 12);
|
||||
}
|
||||
|
||||
// #15357: `each` should behave similar to foreach
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15357
|
||||
// `each` should behave similar to foreach
|
||||
@system unittest
|
||||
{
|
||||
import std.range : lockstep;
|
||||
|
@ -1502,7 +1511,7 @@ private struct FilterResult(alias pred, Range)
|
|||
assert(equal(filter!underX(list), [ 1, 2, 3, 4 ]));
|
||||
}
|
||||
|
||||
// issue 19823
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19823
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
|
@ -1793,7 +1802,7 @@ if (isInputRange!R)
|
|||
import std.algorithm.comparison : equal;
|
||||
import std.typecons : tuple;
|
||||
|
||||
// Issue 13857
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13857
|
||||
immutable(int)[] a1 = [1,1,2,2,2,3,4,4,5,6,6,7,8,9,9,9];
|
||||
auto g1 = group(a1);
|
||||
assert(equal(g1, [ tuple(1, 2u), tuple(2, 3u), tuple(3, 1u),
|
||||
|
@ -1801,12 +1810,12 @@ if (isInputRange!R)
|
|||
tuple(7, 1u), tuple(8, 1u), tuple(9, 3u)
|
||||
]));
|
||||
|
||||
// Issue 13162
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13162
|
||||
immutable(ubyte)[] a2 = [1, 1, 1, 0, 0, 0];
|
||||
auto g2 = a2.group;
|
||||
assert(equal(g2, [ tuple(1, 3u), tuple(0, 3u) ]));
|
||||
|
||||
// Issue 10104
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10104
|
||||
const a3 = [1, 1, 2, 2];
|
||||
auto g3 = a3.group;
|
||||
assert(equal(g3, [ tuple(1, 2u), tuple(2, 2u) ]));
|
||||
|
@ -1849,7 +1858,8 @@ if (isInputRange!R)
|
|||
assert(t.equal([ tuple(3, 1u), tuple(4, 3u), tuple(5, 1u) ]));
|
||||
}
|
||||
|
||||
pure @safe unittest // issue 18657
|
||||
// https://issues.dlang.org/show_bug.cgi?id=18657
|
||||
pure @safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.range : refRange;
|
||||
|
@ -2402,7 +2412,9 @@ version (none) // this example requires support for non-equivalence relations
|
|||
assert(!range.empty); // Opposite of refInputRange test
|
||||
}
|
||||
|
||||
/* Issue 93532 - General behavior of non-forward input ranges.
|
||||
/* https://issues.dlang.org/show_bug.cgi?id=19532
|
||||
* General behavior of non-forward input ranges.
|
||||
*
|
||||
* - If the same chunk is retrieved multiple times via front, the separate chunk
|
||||
* instances refer to a shared range segment that advances as a single range.
|
||||
* - Emptying a chunk via popFront does not implicitly popFront the chunk off
|
||||
|
@ -2517,7 +2529,7 @@ version (none) // this example requires support for non-equivalence relations
|
|||
}
|
||||
}
|
||||
|
||||
// Issue 93532 - Using roundRobin/chunkBy
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19532 - Using roundRobin/chunkBy
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.range : roundRobin;
|
||||
|
@ -2541,7 +2553,7 @@ version (none) // this example requires support for non-equivalence relations
|
|||
assert(r3.equal!equal(expected));
|
||||
}
|
||||
|
||||
// Issue 93532 - Using merge/chunkBy
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19532 - Using merge/chunkBy
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.algorithm.sorting : merge;
|
||||
|
@ -2564,7 +2576,7 @@ version (none) // this example requires support for non-equivalence relations
|
|||
assert(r3.equal!equal(expected));
|
||||
}
|
||||
|
||||
// Issue 93532 - Using chunkBy/map-fold
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19532 - Using chunkBy/map-fold
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.algorithm.iteration : fold, map;
|
||||
|
@ -2588,7 +2600,10 @@ version (none) // this example requires support for non-equivalence relations
|
|||
assert(r3.equal(expected));
|
||||
}
|
||||
|
||||
// Issues 16169, 17966, 93532 - Using multiwayMerge/chunkBy
|
||||
// https://issues.dlang.org/show_bug.cgi?id=16169
|
||||
// https://issues.dlang.org/show_bug.cgi?id=17966
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19532
|
||||
// Using multiwayMerge/chunkBy
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.algorithm.setops : multiwayMerge;
|
||||
|
@ -2628,7 +2643,7 @@ version (none) // this example requires support for non-equivalence relations
|
|||
|
||||
}
|
||||
|
||||
// Issue 13595
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13595
|
||||
version (none) // This requires support for non-equivalence relations
|
||||
@system unittest
|
||||
{
|
||||
|
@ -2642,7 +2657,7 @@ version (none) // This requires support for non-equivalence relations
|
|||
]));
|
||||
}
|
||||
|
||||
// Issue 13805
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13805
|
||||
@system unittest
|
||||
{
|
||||
[""].map!((s) => s).chunkBy!((x, y) => true);
|
||||
|
@ -2893,7 +2908,7 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR)
|
|||
import std.algorithm.comparison : equal;
|
||||
import std.range;
|
||||
|
||||
// Related to issue 8061
|
||||
// Related to https://issues.dlang.org/show_bug.cgi?id=8061
|
||||
auto r = joiner([
|
||||
inputRangeObject("abc"),
|
||||
inputRangeObject("def"),
|
||||
|
@ -2930,7 +2945,7 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR)
|
|||
|
||||
assert(equal(u, "+-abc+-+-def+-"));
|
||||
|
||||
// Issue 13441: only(x) as separator
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13441: only(x) as separator
|
||||
string[][] lines = [null];
|
||||
lines
|
||||
.joiner(only("b"))
|
||||
|
@ -3290,11 +3305,11 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR))
|
|||
import std.range.interfaces : inputRangeObject;
|
||||
import std.range : retro;
|
||||
|
||||
// bugzilla 8240
|
||||
// https://issues.dlang.org/show_bug.cgi?id=8240
|
||||
assert(equal(joiner([inputRangeObject("")]), ""));
|
||||
assert(equal(joiner([inputRangeObject("")]).retro, ""));
|
||||
|
||||
// issue 8792
|
||||
// https://issues.dlang.org/show_bug.cgi?id=8792
|
||||
auto b = [[1], [2], [3]];
|
||||
auto jb = joiner(b);
|
||||
auto js = jb.save;
|
||||
|
@ -3515,7 +3530,7 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR))
|
|||
to!string("Unexpected result: '%s'"d.algoFormat(result)));
|
||||
}
|
||||
|
||||
// Issue 8061
|
||||
// https://issues.dlang.org/show_bug.cgi?id=8061
|
||||
@system unittest
|
||||
{
|
||||
import std.conv : to;
|
||||
|
@ -3592,7 +3607,7 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR))
|
|||
}
|
||||
}
|
||||
|
||||
// Issue 19850
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19850
|
||||
@safe pure unittest
|
||||
{
|
||||
assert([[0]].joiner.save.back == 0);
|
||||
|
@ -3732,7 +3747,7 @@ if (fun.length >= 1)
|
|||
alias E = Select!(isInputRange!R, ElementType!R, ForeachType!R);
|
||||
|
||||
static if (mustInitialize) bool initialized = false;
|
||||
foreach (/+auto ref+/ E e; r) // @@@4707@@@
|
||||
foreach (/+auto ref+/ E e; r) // https://issues.dlang.org/show_bug.cgi?id=4707
|
||||
{
|
||||
foreach (i, f; binfuns)
|
||||
{
|
||||
|
@ -3941,7 +3956,8 @@ The number of seeds must be correspondingly increased.
|
|||
|
||||
@safe unittest
|
||||
{
|
||||
// Issue #10408 - Two-function reduce of a const array.
|
||||
// https://issues.dlang.org/show_bug.cgi?id= 10408
|
||||
// Two-function reduce of a const array.
|
||||
import std.algorithm.comparison : max, min;
|
||||
import std.typecons : tuple, Tuple;
|
||||
|
||||
|
@ -3954,7 +3970,7 @@ The number of seeds must be correspondingly increased.
|
|||
|
||||
@safe unittest
|
||||
{
|
||||
//10709
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10709
|
||||
import std.typecons : tuple, Tuple;
|
||||
|
||||
enum foo = "a + 0.5 * b";
|
||||
|
@ -4021,7 +4037,8 @@ The number of seeds must be correspondingly increased.
|
|||
assert(minmaxElement([1, 2, 3]) == tuple(1, 3));
|
||||
}
|
||||
|
||||
@safe unittest //12569
|
||||
// https://issues.dlang.org/show_bug.cgi?id=12569
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : max, min;
|
||||
import std.typecons : tuple;
|
||||
|
@ -4042,7 +4059,8 @@ The number of seeds must be correspondingly increased.
|
|||
static assert(!is(typeof(reduce!(all, all)(tuple(1, 1), "hello"))));
|
||||
}
|
||||
|
||||
@safe unittest //13304
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13304
|
||||
@safe unittest
|
||||
{
|
||||
int[] data;
|
||||
static assert(is(typeof(reduce!((a, b) => a + b)(data))));
|
||||
|
@ -4514,7 +4532,8 @@ The number of seeds must be correspondingly increased.
|
|||
assert(minmaxElement([1, 2, 3]).equal([tuple(1, 1), tuple(1, 2), tuple(1, 3)]));
|
||||
}
|
||||
|
||||
@safe unittest //12569
|
||||
// https://issues.dlang.org/show_bug.cgi?id=12569
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal, max, min;
|
||||
import std.typecons : tuple;
|
||||
|
@ -4537,7 +4556,8 @@ The number of seeds must be correspondingly increased.
|
|||
static assert(!__traits(compiles, cumulativeFold!(all, all)("hello", tuple(1, 1))));
|
||||
}
|
||||
|
||||
@safe unittest //13304
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13304
|
||||
@safe unittest
|
||||
{
|
||||
int[] data;
|
||||
assert(data.cumulativeFold!((a, b) => a + b).empty);
|
||||
|
@ -4937,7 +4957,9 @@ if (is(typeof(binaryFun!pred(r.front, s)) : bool)
|
|||
assert(split.front == "b ");
|
||||
assert(split.back == "r ");
|
||||
|
||||
foreach (DummyType; AllDummyRanges) { // Bug 4408
|
||||
// https://issues.dlang.org/show_bug.cgi?id=4408
|
||||
foreach (DummyType; AllDummyRanges)
|
||||
{
|
||||
static if (isRandomAccessRange!DummyType)
|
||||
{
|
||||
static assert(isBidirectionalRange!DummyType);
|
||||
|
@ -4964,7 +4986,8 @@ if (is(typeof(binaryFun!pred(r.front, s)) : bool)
|
|||
assert(s.empty);
|
||||
}
|
||||
|
||||
@safe unittest // issue 18470
|
||||
// https://issues.dlang.org/show_bug.cgi?id=18470
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
|
||||
|
@ -4972,7 +4995,8 @@ if (is(typeof(binaryFun!pred(r.front, s)) : bool)
|
|||
assert(w.splitter!((a, b) => a.front() == b)(1).equal([[[0]], [[2]]]));
|
||||
}
|
||||
|
||||
@safe unittest // issue 18470
|
||||
// https://issues.dlang.org/show_bug.cgi?id=18470
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.ascii : toLower;
|
||||
|
@ -5138,11 +5162,11 @@ if (is(typeof(binaryFun!pred(r.front, s.front)) : bool)
|
|||
assert(equal(sp6, ["", ""][]));
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10773
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
|
||||
// Issue 10773
|
||||
auto s = splitter("abc", "");
|
||||
assert(s.equal(["a", "b", "c"]));
|
||||
}
|
||||
|
@ -5383,7 +5407,7 @@ private struct SplitterResult(alias isTerminator, Range)
|
|||
import std.algorithm.comparison : equal;
|
||||
import std.uni : isWhite;
|
||||
|
||||
//@@@6791@@@
|
||||
// https://issues.dlang.org/show_bug.cgi?id=6791
|
||||
assert(equal(
|
||||
splitter("là dove terminava quella valle"),
|
||||
["là", "dove", "terminava", "quella", "valle"]
|
||||
|
@ -5395,7 +5419,8 @@ private struct SplitterResult(alias isTerminator, Range)
|
|||
assert(equal(splitter!"a=='本'"("日本語"), ["日", "語"]));
|
||||
}
|
||||
|
||||
pure @safe unittest // issue 18657
|
||||
// https://issues.dlang.org/show_bug.cgi?id=18657
|
||||
pure @safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.range : refRange;
|
||||
|
@ -5621,9 +5646,9 @@ if (isSomeString!Range ||
|
|||
assert(dictionary["last".byCodeUnit]== 4);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19238
|
||||
@safe pure unittest
|
||||
{
|
||||
// issue 19238
|
||||
import std.utf : byCodeUnit;
|
||||
import std.algorithm.comparison : equal;
|
||||
auto range = "hello world".byCodeUnit.splitter;
|
||||
|
@ -6334,7 +6359,7 @@ if (isInputRange!R && Substs.length >= 2 && !is(CommonType!(Substs) == void))
|
|||
}}
|
||||
}
|
||||
|
||||
// issue 19207
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19207
|
||||
@safe pure nothrow unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
|
@ -6634,7 +6659,8 @@ private auto sumKahan(Result, R)(Result result, R r)
|
|||
assert(sum(SList!double(1, 2, 3, 4)[]) == 10);
|
||||
}
|
||||
|
||||
@safe pure nothrow unittest // 12434
|
||||
// https://issues.dlang.org/show_bug.cgi?id=12434
|
||||
@safe pure nothrow unittest
|
||||
{
|
||||
immutable a = [10, 20];
|
||||
auto s1 = sum(a);
|
||||
|
@ -6936,7 +6962,8 @@ private struct UniqResult(alias pred, Range)
|
|||
}
|
||||
}
|
||||
|
||||
@safe unittest // https://issues.dlang.org/show_bug.cgi?id=17264
|
||||
// https://issues.dlang.org/show_bug.cgi?id=17264
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ if (isInputRange!InputRange && isForwardRange!ForwardRange)
|
|||
assert(equal(arr, [1, 2, 3, 4, 5, 6, 7]));
|
||||
}
|
||||
|
||||
// Bugzilla 16959
|
||||
// https://issues.dlang.org/show_bug.cgi?id=16959
|
||||
auto arr = ['4', '5', '6', '7', '1', '2', '3'];
|
||||
auto p = bringToFront(arr[0 .. 4], arr[4 .. $]);
|
||||
|
||||
|
@ -507,7 +507,8 @@ $(LINK2 http://en.cppreference.com/w/cpp/algorithm/copy_backward, STL's `copy_ba
|
|||
assert(a[4 .. 9] == [6, 7, 8, 9, 10]);
|
||||
}
|
||||
|
||||
{ // Test for bug 7898
|
||||
// https://issues.dlang.org/show_bug.cgi?id=7898
|
||||
{
|
||||
enum v =
|
||||
{
|
||||
import std.algorithm;
|
||||
|
@ -520,9 +521,9 @@ $(LINK2 http://en.cppreference.com/w/cpp/algorithm/copy_backward, STL's `copy_ba
|
|||
}
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13650
|
||||
@safe unittest
|
||||
{
|
||||
// Issue 13650
|
||||
import std.meta : AliasSeq;
|
||||
static foreach (Char; AliasSeq!(char, wchar, dchar))
|
||||
{{
|
||||
|
@ -534,7 +535,8 @@ $(LINK2 http://en.cppreference.com/w/cpp/algorithm/copy_backward, STL's `copy_ba
|
|||
}}
|
||||
}
|
||||
|
||||
@safe unittest // issue 18804
|
||||
// https://issues.dlang.org/show_bug.cgi?id=18804
|
||||
@safe unittest
|
||||
{
|
||||
static struct NullSink
|
||||
{
|
||||
|
@ -607,7 +609,8 @@ if ((isInputRange!Range && is(typeof(range.front = value)) ||
|
|||
assert(a == [ 5, 5, 5, 5 ]);
|
||||
}
|
||||
|
||||
// issue 16342, test fallback on mutable narrow strings
|
||||
// test fallback on mutable narrow strings
|
||||
// https://issues.dlang.org/show_bug.cgi?id=16342
|
||||
@safe unittest
|
||||
{
|
||||
char[] chars = ['a', 'b'];
|
||||
|
@ -670,7 +673,7 @@ if ((isInputRange!Range && is(typeof(range.front = value)) ||
|
|||
chars[1 .. 3].fill(':');
|
||||
assert(chars == "a::d");
|
||||
}
|
||||
// end issue 16342
|
||||
// end https://issues.dlang.org/show_bug.cgi?id=16342
|
||||
|
||||
@safe unittest
|
||||
{
|
||||
|
@ -1136,7 +1139,7 @@ pure nothrow @safe @nogc unittest
|
|||
move(s21, s22);
|
||||
assert(s21 == s22);
|
||||
});
|
||||
// Issue 5661 test(1)
|
||||
// https://issues.dlang.org/show_bug.cgi?id=5661 test(1)
|
||||
static struct S3
|
||||
{
|
||||
static struct X { int n = 0; ~this(){n = 0;} }
|
||||
|
@ -1149,7 +1152,7 @@ pure nothrow @safe @nogc unittest
|
|||
assert(s31.x.n == 0);
|
||||
assert(s32.x.n == 1);
|
||||
|
||||
// Issue 5661 test(2)
|
||||
// https://issues.dlang.org/show_bug.cgi?id=5661 test(2)
|
||||
static struct S4
|
||||
{
|
||||
static struct X { int n = 0; this(this){n = 0;} }
|
||||
|
@ -1162,7 +1165,7 @@ pure nothrow @safe @nogc unittest
|
|||
assert(s41.x.n == 0);
|
||||
assert(s42.x.n == 1);
|
||||
|
||||
// Issue 13990 test
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13990 test
|
||||
class S5;
|
||||
|
||||
S5 s51;
|
||||
|
@ -1270,7 +1273,7 @@ private T moveImpl(T)(ref T source)
|
|||
assert(s21 == s22);
|
||||
});
|
||||
|
||||
// Issue 5661 test(1)
|
||||
// https://issues.dlang.org/show_bug.cgi?id=5661 test(1)
|
||||
static struct S3
|
||||
{
|
||||
static struct X { int n = 0; ~this(){n = 0;} }
|
||||
|
@ -1283,7 +1286,7 @@ private T moveImpl(T)(ref T source)
|
|||
assert(s31.x.n == 0);
|
||||
assert(s32.x.n == 1);
|
||||
|
||||
// Issue 5661 test(2)
|
||||
// https://issues.dlang.org/show_bug.cgi?id=5661 test(2)
|
||||
static struct S4
|
||||
{
|
||||
static struct X { int n = 0; this(this){n = 0;} }
|
||||
|
@ -1296,7 +1299,7 @@ private T moveImpl(T)(ref T source)
|
|||
assert(s41.x.n == 0);
|
||||
assert(s42.x.n == 1);
|
||||
|
||||
// Issue 13990 test
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13990 test
|
||||
class S5;
|
||||
|
||||
S5 s51;
|
||||
|
@ -1320,14 +1323,16 @@ private T moveImpl(T)(ref T source)
|
|||
assert(a.n == 0);
|
||||
}
|
||||
|
||||
@safe unittest//Issue 6217
|
||||
// https://issues.dlang.org/show_bug.cgi?id=6217
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.iteration : map;
|
||||
auto x = map!"a"([1,2,3]);
|
||||
x = move(x);
|
||||
}
|
||||
|
||||
@safe unittest// Issue 8055
|
||||
// https://issues.dlang.org/show_bug.cgi?id=8055
|
||||
@safe unittest
|
||||
{
|
||||
static struct S
|
||||
{
|
||||
|
@ -1347,7 +1352,8 @@ private T moveImpl(T)(ref T source)
|
|||
assert(b.x == 0);
|
||||
}
|
||||
|
||||
@system unittest// Issue 8057
|
||||
// https://issues.dlang.org/show_bug.cgi?id=8057
|
||||
@system unittest
|
||||
{
|
||||
int n = 10;
|
||||
struct S
|
||||
|
@ -1369,7 +1375,7 @@ private T moveImpl(T)(ref T source)
|
|||
auto b = foo(a);
|
||||
assert(b.x == 1);
|
||||
|
||||
// Regression 8171
|
||||
// Regression https://issues.dlang.org/show_bug.cgi?id=8171
|
||||
static struct Array(T)
|
||||
{
|
||||
// nested struct has no member
|
||||
|
@ -1476,7 +1482,7 @@ pure nothrow @nogc @system unittest
|
|||
assert(val == 0);
|
||||
}
|
||||
|
||||
// issue 18913
|
||||
// https://issues.dlang.org/show_bug.cgi?id=18913
|
||||
@safe unittest
|
||||
{
|
||||
static struct NoCopy
|
||||
|
@ -1998,7 +2004,7 @@ private auto removeImpl(SwapStrategy s, Range, Offset...)(Range range, Offset of
|
|||
import std.exception : assertThrown;
|
||||
import std.range;
|
||||
|
||||
// http://d.puremagic.com/issues/show_bug.cgi?id=10173
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10173
|
||||
int[] test = iota(0, 10).array();
|
||||
assertThrown(remove!(SwapStrategy.stable)(test, tuple(2, 4), tuple(1, 3)));
|
||||
assertThrown(remove!(SwapStrategy.unstable)(test, tuple(2, 4), tuple(1, 3)));
|
||||
|
@ -2021,7 +2027,7 @@ private auto removeImpl(SwapStrategy s, Range, Offset...)(Range range, Offset of
|
|||
a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
|
||||
assert(remove!(SwapStrategy.unstable)(a, 0, tuple(9, 11)) ==
|
||||
[ 8, 1, 2, 3, 4, 5, 6, 7 ]);
|
||||
// http://d.puremagic.com/issues/show_bug.cgi?id=5224
|
||||
// https://issues.dlang.org/show_bug.cgi?id=5224
|
||||
a = [ 1, 2, 3, 4 ];
|
||||
assert(remove!(SwapStrategy.unstable)(a, 2) ==
|
||||
[ 1, 2, 4 ]);
|
||||
|
@ -2042,19 +2048,19 @@ private auto removeImpl(SwapStrategy s, Range, Offset...)(Range range, Offset of
|
|||
== [0, 9, 8, 7, 4, 5]);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=11576
|
||||
@safe unittest
|
||||
{
|
||||
// Issue 11576
|
||||
auto arr = [1,2,3];
|
||||
arr = arr.remove!(SwapStrategy.unstable)(2);
|
||||
assert(arr == [1,2]);
|
||||
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=12889
|
||||
@safe unittest
|
||||
{
|
||||
import std.range;
|
||||
// Bug# 12889
|
||||
int[1][] arr = [[0], [1], [2], [3], [4], [5], [6]];
|
||||
auto orig = arr.dup;
|
||||
foreach (i; iota(arr.length))
|
||||
|
@ -2913,9 +2919,9 @@ if (isBlitAssignable!T && !is(typeof(lhs.proxySwap(rhs))))
|
|||
static assert(!__traits(compiles, swap(const1, const2)));
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=4789
|
||||
@safe unittest
|
||||
{
|
||||
//Bug# 4789
|
||||
int[1] s = [1];
|
||||
swap(s, s);
|
||||
|
||||
|
@ -2953,23 +2959,24 @@ if (isBlitAssignable!T && !is(typeof(lhs.proxySwap(rhs))))
|
|||
assert(s.i3 == 2);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=11853
|
||||
@safe unittest
|
||||
{
|
||||
//11853
|
||||
import std.traits : isAssignable;
|
||||
alias T = Tuple!(int, double);
|
||||
static assert(isAssignable!T);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=12024
|
||||
@safe unittest
|
||||
{
|
||||
// 12024
|
||||
import std.datetime;
|
||||
SysTime a, b;
|
||||
swap(a, b);
|
||||
}
|
||||
|
||||
@system unittest // 9975
|
||||
// https://issues.dlang.org/show_bug.cgi?id=9975
|
||||
@system unittest
|
||||
{
|
||||
import std.exception : doesPointTo, mayPointTo;
|
||||
static struct S2
|
||||
|
|
|
@ -569,7 +569,7 @@ if (isNarrowString!R1 && isNarrowString!R2)
|
|||
assert(commonPrefix(to!S("hello, world"), to!T("hello, ")) == to!S("hello, "));
|
||||
assert(commonPrefix(to!S("hello, world"), to!T("hello, world")) == to!S("hello, world"));
|
||||
|
||||
//Bug# 8890
|
||||
// https://issues.dlang.org/show_bug.cgi?id=8890
|
||||
assert(commonPrefix(to!S("Пиво"), to!T("Пони"))== to!S("П"));
|
||||
assert(commonPrefix(to!S("Пони"), to!T("Пиво"))== to!S("П"));
|
||||
assert(commonPrefix(to!S("Пиво"), to!T("Пиво"))== to!S("Пиво"));
|
||||
|
@ -735,7 +735,7 @@ if (isInputRange!R && !isInfinite!R)
|
|||
assert(count("日本語") == 3);
|
||||
}
|
||||
|
||||
// Issue 11253
|
||||
// https://issues.dlang.org/show_bug.cgi?id=11253
|
||||
@safe nothrow unittest
|
||||
{
|
||||
assert([1, 2, 3].count([2, 3]) == 1);
|
||||
|
@ -847,7 +847,8 @@ if (isForwardRange!R
|
|||
}
|
||||
}
|
||||
|
||||
//Because of @@@8804@@@: Avoids both "unreachable code" or "no return statement"
|
||||
// Because of https://issues.dlang.org/show_bug.cgi?id=8804
|
||||
// Avoids both "unreachable code" or "no return statement"
|
||||
static if (isInfinite!R) assert(false, R.stringof ~ " must not be an"
|
||||
~ " infinite range");
|
||||
else return -1;
|
||||
|
@ -951,7 +952,8 @@ if (isInputRange!R &&
|
|||
}
|
||||
}
|
||||
|
||||
//Because of @@@8804@@@: Avoids both "unreachable code" or "no return statement"
|
||||
// Because of https://issues.dlang.org/show_bug.cgi?id=8804
|
||||
// Avoids both "unreachable code" or "no return statement"
|
||||
static if (isInfinite!R) assert(false, R.stringof ~ " must not be an"
|
||||
~ " inifite range");
|
||||
else return -1;
|
||||
|
@ -1196,7 +1198,8 @@ if (isInputRange!R &&
|
|||
import std.meta : AliasSeq;
|
||||
|
||||
static foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring))
|
||||
(){ // workaround slow optimizations for large functions @@@BUG@@@ 2396
|
||||
(){ // workaround slow optimizations for large functions
|
||||
// https://issues.dlang.org/show_bug.cgi?id=2396
|
||||
assert(!endsWith(to!S("abc"), 'a'));
|
||||
assert(endsWith(to!S("abc"), 'a', 'c') == 2);
|
||||
assert(!endsWith(to!S("abc"), 'x', 'n', 'b'));
|
||||
|
@ -1572,7 +1575,7 @@ if (isInputRange!InputRange &&
|
|||
|
||||
// If the haystack is a SortedRange we can use binary search to find the needle.
|
||||
// Works only for the default find predicate and any SortedRange predicate.
|
||||
// 8829 enhancement
|
||||
// https://issues.dlang.org/show_bug.cgi?id=8829
|
||||
import std.range : SortedRange;
|
||||
static if (is(InputRange : SortedRange!TT, TT) && isDefaultPred)
|
||||
{
|
||||
|
@ -1658,7 +1661,7 @@ if (isInputRange!InputRange &&
|
|||
}
|
||||
else static if (isArray!R)
|
||||
{
|
||||
//10403 optimization
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10403 optimization
|
||||
static if (isDefaultPred && isIntegral!EType && EType.sizeof == 1 && isIntegralNeedle)
|
||||
{
|
||||
import std.algorithm.comparison : max, min;
|
||||
|
@ -1810,9 +1813,9 @@ if (isInputRange!InputRange &&
|
|||
assertCTFEable!dg;
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=11603
|
||||
@safe unittest
|
||||
{
|
||||
// Bugzilla 11603
|
||||
enum Foo : ubyte { A }
|
||||
assert([Foo.A].find(Foo.A).empty == false);
|
||||
|
||||
|
@ -1978,7 +1981,7 @@ if (isForwardRange!R1 && isForwardRange!R2
|
|||
// Binary search can be used to find the first occurence
|
||||
// of the first element of the needle in haystack.
|
||||
// When it is found O(walklength(needle)) steps are performed.
|
||||
// 8829 enhancement
|
||||
// https://issues.dlang.org/show_bug.cgi?id=8829 enhancement
|
||||
import std.algorithm.comparison : mismatch;
|
||||
import std.range : SortedRange;
|
||||
static if (is(R1 == R2)
|
||||
|
@ -2099,7 +2102,8 @@ if (isForwardRange!R1 && isForwardRange!R2
|
|||
assert([C(1,0), C(2,0), C(3,1), C(4,0)].find!"a.x == b"(SList!int(2, 3)[]) == [C(2,0), C(3,1), C(4,0)]);
|
||||
}
|
||||
|
||||
@safe unittest // issue 12470
|
||||
// https://issues.dlang.org/show_bug.cgi?id=12470
|
||||
@safe unittest
|
||||
{
|
||||
import std.array : replace;
|
||||
inout(char)[] sanitize(inout(char)[] p)
|
||||
|
@ -2167,7 +2171,7 @@ if (isForwardRange!R1 && isForwardRange!R2
|
|||
assert(find([ 1, 2, 1, 2, 3, 3 ], SList!int(2, 3)[]) == [ 2, 3, 3 ]);
|
||||
}
|
||||
|
||||
//Bug# 8334
|
||||
// https://issues.dlang.org/show_bug.cgi?id=8334
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.iteration : filter;
|
||||
|
@ -2183,7 +2187,7 @@ if (isForwardRange!R1 && isForwardRange!R2
|
|||
assert(find(haystack, filter!"true"(needle)).empty);
|
||||
}
|
||||
|
||||
// issue 11013
|
||||
// https://issues.dlang.org/show_bug.cgi?id=11013
|
||||
@safe unittest
|
||||
{
|
||||
assert(find!"a == a"("abc","abc") == "abc");
|
||||
|
@ -2665,7 +2669,7 @@ if (isForwardRange!(Range))
|
|||
ReferenceForwardRange!int rfr = new ReferenceForwardRange!int([1, 2, 3, 2, 2, 3]);
|
||||
assert(equal(findAdjacent(rfr), [2, 2, 3]));
|
||||
|
||||
// Issue 9350
|
||||
// https://issues.dlang.org/show_bug.cgi?id=9350
|
||||
assert(!repeat(1).findAdjacent().empty);
|
||||
}
|
||||
|
||||
|
@ -2718,7 +2722,8 @@ if (isInputRange!InputRange && isForwardRange!ForwardRange)
|
|||
assert(findAmong!("a == b")(b, [ 4, 6, 7 ][]).empty);
|
||||
}
|
||||
|
||||
@system unittest // issue 19765
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19765
|
||||
@system unittest
|
||||
{
|
||||
import std.range.interfaces : inputRangeObject;
|
||||
auto choices = inputRangeObject("b");
|
||||
|
@ -2781,7 +2786,8 @@ if (isForwardRange!R1 && isForwardRange!R2
|
|||
assert(findSkip(s, "def") && s.empty);
|
||||
}
|
||||
|
||||
@safe unittest // issue 19020
|
||||
// https://issues.dlang.org/show_bug.cgi?id=19020
|
||||
@safe unittest
|
||||
{
|
||||
static struct WrapperRange
|
||||
{
|
||||
|
@ -3313,7 +3319,7 @@ if (isForwardRange!R1 && isForwardRange!R2)
|
|||
assert(split[1] == "one");
|
||||
}
|
||||
|
||||
// issue 11013
|
||||
// https://issues.dlang.org/show_bug.cgi?id=11013
|
||||
@safe pure unittest
|
||||
{
|
||||
auto var = "abc";
|
||||
|
@ -4842,7 +4848,8 @@ if (isInputRange!R &&
|
|||
import std.range;
|
||||
|
||||
static foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring))
|
||||
(){ // workaround slow optimizations for large functions @@@BUG@@@ 2396
|
||||
(){ // workaround slow optimizations for large functions
|
||||
// https://issues.dlang.org/show_bug.cgi?id=2396
|
||||
assert(!startsWith(to!S("abc"), 'c'));
|
||||
assert(startsWith(to!S("abc"), 'a', 'c') == 1);
|
||||
assert(!startsWith(to!S("abc"), 'x', 'n', 'b'));
|
||||
|
@ -5125,7 +5132,8 @@ if (isInputRange!Range)
|
|||
assert(equal(until!"a == 2"(a, No.openRight), [1, 2]));
|
||||
}
|
||||
|
||||
@system unittest // bugzilla 13171
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13171
|
||||
@system unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.range;
|
||||
|
@ -5134,7 +5142,8 @@ if (isInputRange!Range)
|
|||
assert(a == [4]);
|
||||
}
|
||||
|
||||
@safe unittest // Issue 10460
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10460
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
auto a = [1, 2, 3, 4];
|
||||
|
@ -5143,14 +5152,16 @@ if (isInputRange!Range)
|
|||
assert(equal(a, [0, 0, 3, 4]));
|
||||
}
|
||||
|
||||
@safe unittest // Issue 13124
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13124
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : among, equal;
|
||||
auto s = "hello how\nare you";
|
||||
assert(equal(s.until!(c => c.among!('\n', '\r')), "hello how"));
|
||||
}
|
||||
|
||||
pure @safe unittest // issue 18657
|
||||
// https://issues.dlang.org/show_bug.cgi?id=18657
|
||||
pure @safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.range : refRange;
|
||||
|
|
|
@ -346,7 +346,7 @@ if (!allSatisfy!(isForwardRange, R1, R2) ||
|
|||
}
|
||||
}
|
||||
|
||||
// Issue 13091
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13091
|
||||
pure nothrow @safe @nogc unittest
|
||||
{
|
||||
int[1] a = [1];
|
||||
|
@ -421,9 +421,10 @@ if (ranges.length >= 2 &&
|
|||
return Result(ranges);
|
||||
}
|
||||
|
||||
// cartesian product of empty ranges should be empty
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10693
|
||||
@safe unittest
|
||||
{
|
||||
// Issue 10693: cartesian product of empty ranges should be empty.
|
||||
int[] a, b, c, d, e;
|
||||
auto cprod = cartesianProduct(a,b,c,d,e);
|
||||
assert(cprod.empty);
|
||||
|
@ -445,9 +446,9 @@ if (ranges.length >= 2 &&
|
|||
assert(cprod.init.empty);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13393
|
||||
@safe unittest
|
||||
{
|
||||
// Issue 13393
|
||||
assert(!cartesianProduct([0],[0],[0]).save.empty);
|
||||
}
|
||||
|
||||
|
@ -506,7 +507,7 @@ if (!allSatisfy!(isForwardRange, R1, R2, RR) ||
|
|||
assert(canFind(N4, tuple(10, 3, 1, 2)));
|
||||
}
|
||||
|
||||
// Issue 9878
|
||||
// https://issues.dlang.org/show_bug.cgi?id=9878
|
||||
///
|
||||
@safe unittest
|
||||
{
|
||||
|
@ -545,7 +546,7 @@ pure @safe nothrow @nogc unittest
|
|||
assert(D.front == front1);
|
||||
}
|
||||
|
||||
// Issue 13935
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13935
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.iteration : map;
|
||||
|
@ -1109,7 +1110,8 @@ SetDifference!(less, R1, R2) setDifference(alias less = "a < b", R1, R2)
|
|||
assert(setDifference(r, x).empty);
|
||||
}
|
||||
|
||||
@safe unittest // Issue 10460
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10460
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
|
||||
|
@ -1429,7 +1431,8 @@ setSymmetricDifference(alias less = "a < b", R1, R2)
|
|||
assert(equal(setSymmetricDifference(c, d), [1, 1, 2, 5, 6, 7, 9]));
|
||||
}
|
||||
|
||||
@safe unittest // Issue 10460
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10460
|
||||
@safe unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ if (isForwardRange!(Range))
|
|||
{
|
||||
import std.conv : to;
|
||||
|
||||
// Issue 9457
|
||||
// https://issues.dlang.org/show_bug.cgi?id=9457
|
||||
auto x = "abcd";
|
||||
assert(isSorted(x));
|
||||
auto y = "acbd";
|
||||
|
@ -1563,7 +1563,8 @@ private void multiSortImpl(Range, SwapStrategy ss, funs...)(Range r)
|
|||
assert(pts4.multiSort!("a > b").release.equal(iota(10).retro));
|
||||
}
|
||||
|
||||
@safe unittest //issue 9160 (L-value only comparators)
|
||||
//https://issues.dlang.org/show_bug.cgi?id=9160 (L-value only comparators)
|
||||
@safe unittest
|
||||
{
|
||||
static struct A
|
||||
{
|
||||
|
@ -1587,7 +1588,9 @@ private void multiSortImpl(Range, SwapStrategy ss, funs...)(Range r)
|
|||
assert(points[1] == A(4, 1));
|
||||
}
|
||||
|
||||
@safe unittest // issue 16179 (cannot access frame of function)
|
||||
// cannot access frame of function
|
||||
// https://issues.dlang.org/show_bug.cgi?id=16179
|
||||
@safe unittest
|
||||
{
|
||||
auto arr = [[1, 2], [2, 0], [1, 0], [1, 1]];
|
||||
int c = 3;
|
||||
|
@ -1599,7 +1602,8 @@ private void multiSortImpl(Range, SwapStrategy ss, funs...)(Range r)
|
|||
assert(arr == [[1, 0], [1, 1], [1, 2], [2, 0]]);
|
||||
}
|
||||
|
||||
@safe unittest //Issue 16413 - @system comparison function
|
||||
// https://issues.dlang.org/show_bug.cgi?id=16413 - @system comparison function
|
||||
@safe unittest
|
||||
{
|
||||
bool lt(int a, int b) { return a < b; } static @system
|
||||
auto a = [2, 1];
|
||||
|
@ -2015,14 +2019,14 @@ if (((ss == SwapStrategy.unstable && (hasSwappableElements!Range ||
|
|||
assert(isSorted!("toUpper(a) < toUpper(b)")(b));
|
||||
|
||||
{
|
||||
// Issue 10317
|
||||
// https://issues.dlang.org/show_bug.cgi?id=10317
|
||||
enum E_10317 { a, b }
|
||||
auto a_10317 = new E_10317[10];
|
||||
sort(a_10317);
|
||||
}
|
||||
|
||||
{
|
||||
// Issue 7767
|
||||
// https://issues.dlang.org/show_bug.cgi?id=7767
|
||||
// Unstable sort should complete without an excessive number of predicate calls
|
||||
// This would suggest it's running in quadratic time
|
||||
|
||||
|
@ -2137,7 +2141,7 @@ package(std) template HeapOps(alias less, Range)
|
|||
|
||||
alias lessFun = binaryFun!less;
|
||||
|
||||
//template because of @@@12410@@@
|
||||
//template because of https://issues.dlang.org/show_bug.cgi?id=12410
|
||||
void heapSort()(Range r)
|
||||
{
|
||||
// If true, there is nothing to do
|
||||
|
@ -2152,7 +2156,7 @@ package(std) template HeapOps(alias less, Range)
|
|||
}
|
||||
}
|
||||
|
||||
//template because of @@@12410@@@
|
||||
//template because of https://issues.dlang.org/show_bug.cgi?id=12410
|
||||
void buildHeap()(Range r)
|
||||
{
|
||||
immutable n = r.length;
|
||||
|
@ -2177,7 +2181,7 @@ package(std) template HeapOps(alias less, Range)
|
|||
|
||||
// Sifts down r[parent] (which is initially assumed to be messed up) so the
|
||||
// heap property is restored for r[parent .. end].
|
||||
// template because of @@@12410@@@
|
||||
// template because of https://issues.dlang.org/show_bug.cgi?id=12410
|
||||
void siftDown()(Range r, size_t parent, immutable size_t end)
|
||||
{
|
||||
for (;;)
|
||||
|
@ -2205,7 +2209,7 @@ package(std) template HeapOps(alias less, Range)
|
|||
// restored. So there are more swaps but fewer comparisons. Gains are made
|
||||
// when the final position is likely to end toward the bottom of the heap,
|
||||
// so not a lot of sifts back are performed.
|
||||
//template because of @@@12410@@@
|
||||
//template because of https://issues.dlang.org/show_bug.cgi?id=12410
|
||||
void percolate()(Range r, size_t parent, immutable size_t end)
|
||||
{
|
||||
immutable root = parent;
|
||||
|
@ -2873,8 +2877,9 @@ private template TimSortImpl(alias pred, R)
|
|||
assert(result == true, "invalid result");
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=4584
|
||||
@safe unittest
|
||||
{//bugzilla 4584
|
||||
{
|
||||
assert(isSorted!"a < b"(sort!("a < b", SwapStrategy.stable)(
|
||||
[83, 42, 85, 86, 87, 22, 89, 30, 91, 46, 93, 94, 95, 6,
|
||||
97, 14, 33, 10, 101, 102, 103, 26, 105, 106, 107, 6]
|
||||
|
@ -2894,9 +2899,9 @@ private template TimSortImpl(alias pred, R)
|
|||
assert(y == "aebcd"d);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=14223
|
||||
@safe unittest
|
||||
{
|
||||
// Issue 14223
|
||||
import std.array, std.range;
|
||||
auto arr = chain(iota(0, 384), iota(0, 256), iota(0, 80), iota(0, 64), iota(0, 96)).array;
|
||||
sort!("a < b", SwapStrategy.stable)(arr);
|
||||
|
@ -3081,33 +3086,33 @@ if (isRandomAccessRange!R && hasLength!R && hasSwappableElements!R)
|
|||
assert(strings == [ "three", "two", "one" ]);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=4909
|
||||
@safe unittest
|
||||
{
|
||||
// issue 4909
|
||||
import std.typecons : Tuple;
|
||||
Tuple!(char)[] chars;
|
||||
schwartzSort!"a[0]"(chars);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=5924
|
||||
@safe unittest
|
||||
{
|
||||
// issue 5924
|
||||
import std.typecons : Tuple;
|
||||
Tuple!(char)[] chars;
|
||||
schwartzSort!((Tuple!(char) c){ return c[0]; })(chars);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13965
|
||||
@safe unittest
|
||||
{
|
||||
// issue 13965
|
||||
import std.typecons : Tuple;
|
||||
Tuple!(char)[] chars;
|
||||
schwartzSort!("a[0]", SwapStrategy.stable)(chars);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13965
|
||||
@safe unittest
|
||||
{
|
||||
// issue 13965
|
||||
import std.algorithm.iteration : map;
|
||||
import std.numeric : entropy;
|
||||
|
||||
|
@ -3670,7 +3675,7 @@ done:
|
|||
}
|
||||
}
|
||||
|
||||
// bug 12987
|
||||
// https://issues.dlang.org/show_bug.cgi?id=12987
|
||||
@safe unittest
|
||||
{
|
||||
int[] a = [ 25, 7, 9, 2, 0, 5, 21 ];
|
||||
|
@ -3720,7 +3725,7 @@ if (isRandomAccessRange!(Range1) && hasLength!Range1 &&
|
|||
assert(a == [0, 1, 2, 2, 3]);
|
||||
}
|
||||
|
||||
// bug 15421
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15421
|
||||
@system unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
|
@ -3764,7 +3769,7 @@ if (isRandomAccessRange!(Range1) && hasLength!Range1 &&
|
|||
}
|
||||
}
|
||||
|
||||
// bug 15421
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15421
|
||||
@system unittest
|
||||
{
|
||||
auto a = [ 9, 8, 0, 3, 5, 25, 43, 4, 2, 0, 7 ];
|
||||
|
@ -3783,7 +3788,7 @@ if (isRandomAccessRange!(Range1) && hasLength!Range1 &&
|
|||
assert(a == b);
|
||||
}
|
||||
|
||||
// bug 12987
|
||||
// https://issues.dlang.org/show_bug.cgi?id=12987
|
||||
@system unittest
|
||||
{
|
||||
int[] a = [ 5, 7, 2, 6, 7 ];
|
||||
|
@ -3793,7 +3798,7 @@ if (isRandomAccessRange!(Range1) && hasLength!Range1 &&
|
|||
assert(t == [ 0, 1, 2, 2, 3 ]);
|
||||
}
|
||||
|
||||
// bug 15420
|
||||
// https://issues.dlang.org/show_bug.cgi?id=15420
|
||||
@system unittest
|
||||
{
|
||||
int[] a = [ 5, 7, 2, 6, 7 ];
|
||||
|
@ -4386,7 +4391,7 @@ if (isBidirectionalRange!BidirectionalRange &&
|
|||
assert(a == [3,2,1]);
|
||||
}
|
||||
|
||||
// Issue 13594
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13594
|
||||
@safe unittest
|
||||
{
|
||||
int[3] a = [1,2,3];
|
||||
|
@ -4561,9 +4566,9 @@ if (isBidirectionalRange!BidirectionalRange &&
|
|||
assert(b == [ 1, 3, 2 ]);
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=13594
|
||||
@safe unittest
|
||||
{
|
||||
// Issue 13594
|
||||
int[3] a = [1,2,3];
|
||||
assert(nextEvenPermutation(a[]));
|
||||
assert(a == [2,3,1]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue