summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Wissner <belka@caraus.de>2018-05-01 15:55:31 +0200
committerEugene Wissner <belka@caraus.de>2018-05-01 15:56:07 +0200
commit4f6ce116bcab5b59bbeb829e83b33aaeba5144de (patch)
treefed0280ae93f1c26cde004149f7fc74df28031cd
parentc4424e7e01e5eba8b593fd9a14da41e12d12452e (diff)
downloadtanya-4f6ce116bcab5b59bbeb829e83b33aaeba5144de.tar.gz
Add documented tests for Set.empty and Set.clear()
-rw-r--r--source/tanya/container/set.d19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/tanya/container/set.d b/source/tanya/container/set.d
index 6f1b809..6e158f1 100644
--- a/source/tanya/container/set.d
+++ b/source/tanya/container/set.d
@@ -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];