mirror of
https://github.com/dlang/phobos.git
synced 2025-05-02 16:10:45 +03:00
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:
commit
ee293aa7d9
1 changed files with 3 additions and 4 deletions
|
@ -744,17 +744,16 @@ if (isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range && hasAssig
|
||||||
assert(a == [ 42, 42 ]);
|
assert(a == [ 42, 42 ]);
|
||||||
|
|
||||||
import std.algorithm.iteration : map;
|
import std.algorithm.iteration : map;
|
||||||
|
import std.format : format;
|
||||||
import std.random;
|
import std.random;
|
||||||
import std.stdio;
|
|
||||||
auto s = 123_456_789;
|
auto s = 123_456_789;
|
||||||
auto g = Xorshift(s);
|
auto g = Xorshift(s);
|
||||||
a = iota(0, uniform(1, 1000, g))
|
a = iota(0, uniform(1, 1000, g))
|
||||||
.map!(_ => uniform(-1000, 1000, g))
|
.map!(_ => uniform(-1000, 1000, g))
|
||||||
.array;
|
.array;
|
||||||
scope(failure) writeln("RNG seed was ", s);
|
|
||||||
pivot = pivotPartition!less(a, a.length / 2);
|
pivot = pivotPartition!less(a, a.length / 2);
|
||||||
assert(a[0 .. 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]));
|
assert(a[pivot .. $].all!(x => x >= a[pivot]), "RNG seed: %d".format(s));
|
||||||
}
|
}
|
||||||
test!"a < b";
|
test!"a < b";
|
||||||
static bool myLess(int a, int b)
|
static bool myLess(int a, int b)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue