mirror of
https://github.com/dlang/phobos.git
synced 2025-05-03 00:20:26 +03:00
Added more unittests
This commit is contained in:
parent
68dab0e2e5
commit
e32b635f05
1 changed files with 41 additions and 0 deletions
|
@ -3412,8 +3412,49 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR)
|
||||||
assert(resFront.equal("ȘȚabcȘȚ"));
|
assert(resFront.equal("ȘȚabcȘȚ"));
|
||||||
assert(resBack.equal("ȘȚcbaȘȚ"));
|
assert(resBack.equal("ȘȚcbaȘȚ"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
import std.algorithm.comparison : equal;
|
||||||
|
auto r = [""];
|
||||||
|
r.popBack;
|
||||||
|
assert(r.joiner("AB").equal(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto r = ["", "", "", "abc", ""].joiner("../");
|
||||||
|
auto rCopy = r.save;
|
||||||
|
|
||||||
|
char[] resFront;
|
||||||
|
char[] resBack;
|
||||||
|
|
||||||
|
while (!r.empty)
|
||||||
|
{
|
||||||
|
resFront ~= r.front;
|
||||||
|
r.popFront;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!rCopy.empty)
|
||||||
|
{
|
||||||
|
resBack ~= rCopy.back;
|
||||||
|
rCopy.popBack;
|
||||||
|
}
|
||||||
|
|
||||||
|
import std.algorithm.comparison : equal;
|
||||||
|
|
||||||
|
assert(resFront.equal("../../../abc../"));
|
||||||
|
assert(resBack.equal("../cba../../../"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@system unittest
|
||||||
|
{
|
||||||
|
import std.range;
|
||||||
|
import std.algorithm.comparison : equal;
|
||||||
|
|
||||||
|
assert(inputRangeObject([""]).joiner("lz").equal(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Ditto
|
/// Ditto
|
||||||
auto joiner(RoR)(RoR r)
|
auto joiner(RoR)(RoR r)
|
||||||
if (isInputRange!RoR && isInputRange!(ElementType!RoR))
|
if (isInputRange!RoR && isInputRange!(ElementType!RoR))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue