Merge pull request #6359 from wilzbach/searching-dip1000

Prepare std.algorithm.sorting for -dip1000
merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
This commit is contained in:
The Dlang Bot 2018-04-06 15:14:23 +02:00 committed by GitHub
commit ee293aa7d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -744,17 +744,16 @@ if (isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range && hasAssig
assert(a == [ 42, 42 ]);
import std.algorithm.iteration : map;
import std.format : format;
import std.random;
import std.stdio;
auto s = 123_456_789;
auto g = Xorshift(s);
a = iota(0, uniform(1, 1000, g))
.map!(_ => uniform(-1000, 1000, g))
.array;
scope(failure) writeln("RNG seed was ", s);
pivot = pivotPartition!less(a, a.length / 2);
assert(a[0 .. pivot].all!(x => x <= a[pivot]));
assert(a[pivot .. $].all!(x => x >= a[pivot]));
assert(a[0 .. pivot].all!(x => x <= a[pivot]), "RNG seed: %d".format(s));
assert(a[pivot .. $].all!(x => x >= a[pivot]), "RNG seed: %d".format(s));
}
test!"a < b";
static bool myLess(int a, int b)