mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Make new tests documented
This commit is contained in:
parent
a2c2f79dfa
commit
edc5bbde7b
1 changed files with 4 additions and 7 deletions
|
@ -2588,6 +2588,10 @@ template canFind(alias pred="a == b")
|
|||
assert(!canFind(arr, 4));
|
||||
|
||||
// find one of several needles
|
||||
assert(arr.canFind(3, 2));
|
||||
assert(arr.canFind(3, 2) == 2); // second needle found
|
||||
assert(arr.canFind([1, 3], 2) == 2);
|
||||
|
||||
assert(canFind(arr, [1, 2], [2, 3]));
|
||||
assert(canFind(arr, [1, 2], [2, 3]) == 1);
|
||||
assert(canFind(arr, [1, 7], [2, 3]));
|
||||
|
@ -2596,13 +2600,6 @@ template canFind(alias pred="a == b")
|
|||
assert(canFind(arr, [1, 3], [2, 4]) == 0);
|
||||
}
|
||||
|
||||
// More multiple needles
|
||||
@safe unittest
|
||||
{
|
||||
assert([1, 2, 3].canFind(3, 2) == 2);
|
||||
assert([1, 2, 3].canFind([1, 3], 2) == 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Example using a custom predicate.
|
||||
* Note that the needle appears as the second argument of the predicate.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue