mirror of
https://github.com/dlang/phobos.git
synced 2025-05-04 17:11:26 +03:00
* selective import
* some symbols where used only private * missing ditto whitespace JakobOvrum review quickfur
This commit is contained in:
parent
eba63621c6
commit
3a468b470f
1 changed files with 6 additions and 8 deletions
|
@ -523,7 +523,7 @@ body
|
|||
static assert(is(typeof(clamp(-1L, -2L, 2UL)) == long));
|
||||
|
||||
// user-defined types
|
||||
import std.datetime;
|
||||
import std.datetime : Date;
|
||||
assert(clamp(Date(1982, 1, 4), Date(1012, 12, 21), Date(2012, 12, 21)) == Date(1982, 1, 4));
|
||||
assert(clamp(Date(1982, 1, 4), Date.min, Date.max) == Date(1982, 1, 4));
|
||||
// UFCS style
|
||||
|
@ -560,7 +560,7 @@ if (isInputRange!R1 && isInputRange!R2 && !(isSomeString!R1 && isSomeString!R2))
|
|||
}
|
||||
}
|
||||
|
||||
// Specialization for strings (for speed purposes)
|
||||
/// ditto
|
||||
int cmp(alias pred = "a < b", R1, R2)(R1 r1, R2 r2) if (isSomeString!R1 && isSomeString!R2)
|
||||
{
|
||||
import core.stdc.string : memcmp;
|
||||
|
@ -635,11 +635,8 @@ int cmp(alias pred = "a < b", R1, R2)(R1 r1, R2 r2) if (isSomeString!R1 && isSom
|
|||
{
|
||||
int result;
|
||||
|
||||
debug(string) printf("string.cmp.unittest\n");
|
||||
result = cmp("abc", "abc");
|
||||
assert(result == 0);
|
||||
// result = cmp(null, null);
|
||||
// assert(result == 0);
|
||||
result = cmp("", "");
|
||||
assert(result == 0);
|
||||
result = cmp("abc", "abcd");
|
||||
|
@ -762,7 +759,8 @@ range of range (of range...) comparisons.
|
|||
{
|
||||
import std.algorithm.iteration : map;
|
||||
import std.math : approxEqual;
|
||||
import std.internal.test.dummyrange;
|
||||
import std.internal.test.dummyrange : ReferenceForwardRange,
|
||||
ReferenceInputRange, ReferenceInfiniteForwardRange;
|
||||
|
||||
debug(std_algorithm) scope(success)
|
||||
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
||||
|
@ -871,7 +869,7 @@ enum EditOp : char
|
|||
remove = 'r'
|
||||
}
|
||||
|
||||
struct Levenshtein(Range, alias equals, CostType = size_t)
|
||||
private struct Levenshtein(Range, alias equals, CostType = size_t)
|
||||
{
|
||||
void deletionIncrement(CostType n)
|
||||
{
|
||||
|
@ -1248,7 +1246,7 @@ MaxType!T max(T...)(T args)
|
|||
assert(max(a, f) == 5);
|
||||
|
||||
//Test user-defined types
|
||||
import std.datetime;
|
||||
import std.datetime : Date;
|
||||
assert(max(Date(2012, 12, 21), Date(1982, 1, 4)) == Date(2012, 12, 21));
|
||||
assert(max(Date(1982, 1, 4), Date(2012, 12, 21)) == Date(2012, 12, 21));
|
||||
assert(max(Date(1982, 1, 4), Date.min) == Date(1982, 1, 4));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue