diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-04-09 23:50:02 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-11-10 18:03:23 +0100 |
commit | 70a3a8927cd7e927ec96bc30f57377b32b080c09 (patch) | |
tree | 7b00edb2f78bf73669a9989a416beb7ecdb5e02b /Scala/funsets/src/test/scala | |
parent | 859af2fa66c152ab6fa2ddc4003ada65315aa5de (diff) | |
download | coursera-70a3a8927cd7e927ec96bc30f57377b32b080c09.zip coursera-70a3a8927cd7e927ec96bc30f57377b32b080c09.tar.gz |
Scala : week2: implement singletonSet, and union
Diffstat (limited to 'Scala/funsets/src/test/scala')
-rw-r--r-- | Scala/funsets/src/test/scala/funsets/FunSetSuite.scala | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala b/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala index e75ba8c..e61a56c 100644 --- a/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala +++ b/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala @@ -101,7 +101,36 @@ class FunSetSuite extends FunSuite { } } - ignore("union contains all elements") { + test("singletonSet(1)") { + new TestSets { + assert(!contains(s1, -1), "fails with -1") + assert(!contains(s1, 0), "fails with 0") + assert(contains(s1, 1), "fails with 1") + assert(!contains(s1, 2), "fails with 2") + assert(!contains(s1, 3), "fails with 3") + } + } + + test("singletonSet(2)") { + new TestSets { + assert(!contains(s2, -1), "fails with -1") + assert(!contains(s2, 0), "fails with 0") + assert(!contains(s2, 1), "fails with 1") + assert(contains(s2, 2), "fails with 2") + assert(!contains(s2, 3), "fails with 3") + } + } + test("singletonSet(3)") { + new TestSets { + assert(!contains(s3, -1), "fails with -1") + assert(!contains(s3, 0), "fails with 0") + assert(!contains(s3, 1), "fails with 1") + assert(!contains(s3, 2), "fails with 2") + assert(contains(s3, 3), "fails with 3") + } + } + + test("union contains all elements") { new TestSets { val s = union(s1, s2) assert(contains(s, 1), "Union 1") |