Skip to content

Commit 1a6fe5d

Browse files
committed
Extend tests
1 parent 3d2892c commit 1a6fe5d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

std/algorithm/searching.d

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3965,14 +3965,21 @@ in (!r.empty)
39653965
assert(extrema([1,5,3,2]) == [1, 5]);
39663966
assert(extrema([2,3,3,2]) == [2, 3]);
39673967

3968+
import std.range;
3969+
assert(iota(2, 5).extrema == [2, 4]);
3970+
assert(iota(3, 7).retro.extrema == [3, 6]);
3971+
39683972
import std.internal.test.dummyrange;
3969-
DummyRange!(ReturnBy.Reference, Length.No, RangeType.Input) r;
3970-
assert(r.extrema == [1u, 10u]);
3973+
foreach (DummyType; AllDummyRanges)
3974+
{
3975+
DummyType d;
3976+
assert(d.extrema == [1, 10]);
3977+
}
39713978

39723979
version (StdRandomTests)
39733980
foreach (i; 0 .. 1000)
39743981
{
3975-
import std.random, std.range;
3982+
import std.random;
39763983
auto arr = generate!(() => uniform(0, 100)).takeExactly(uniform(1, 10)).array;
39773984
auto result = arr.extrema;
39783985
assert(result[0] == arr.minElement);

0 commit comments

Comments
 (0)