Add documented tests for Set.empty and Set.clear()

This commit is contained in:
Eugen Wissner 2018-05-01 15:55:31 +02:00
parent c4424e7e01
commit 4f6ce116bc
1 changed files with 19 additions and 0 deletions

View File

@ -337,6 +337,15 @@ if (is(typeof(hasher(T.init)) == size_t))
return length == 0;
}
///
@nogc nothrow pure @safe unittest
{
Set!int set;
assert(set.empty);
set.insert(5);
assert(!set.empty);
}
/**
* Removes all elements.
*/
@ -345,6 +354,16 @@ if (is(typeof(hasher(T.init)) == size_t))
this.data.clear();
}
///
@nogc nothrow pure @safe unittest
{
Set!int set;
set.insert(5);
assert(!set.empty);
set.clear();
assert(set.empty);
}
/// The maximum number of buckets the container can have.
enum size_t maxBucketCount = primes[$ - 1];