diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-04-10 00:03:54 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-11-10 18:03:23 +0100 |
commit | c5f1113df8159078ac3bfb6fbe8426db72248512 (patch) | |
tree | fe01a593b5906d493e9e490fa29d19471fe862e0 /Scala/funsets/src/test | |
parent | 70a3a8927cd7e927ec96bc30f57377b32b080c09 (diff) | |
download | coursera-c5f1113df8159078ac3bfb6fbe8426db72248512.zip coursera-c5f1113df8159078ac3bfb6fbe8426db72248512.tar.gz |
Scala : week2: implement intersect and diff
Diffstat (limited to 'Scala/funsets/src/test')
-rw-r--r-- | Scala/funsets/src/test/scala/funsets/FunSetSuite.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala b/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala index e61a56c..88dac91 100644 --- a/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala +++ b/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala @@ -138,4 +138,28 @@ class FunSetSuite extends FunSuite { assert(!contains(s, 3), "Union 3") } } + + test("intersect") { + new TestSets { + val s = intersect(s1, s2) + assert(!contains(s, 1), "Intersect none") + assert(!contains(s, 2), "Intersect none") + + val t = intersect(s1, s1) + assert(contains(t, 1), "Intersect 1") + + val v = intersect(s2, s2) + assert(contains(v, 2), "Intersect 2") + } + } + + test("diff") { + new TestSets { + val s = diff(s1, s2) + assert(!contains(s, 0), "Diff none") + assert(contains(s, 1), "Diff 1") + assert(!contains(s, 2), "Diff none") + assert(!contains(s, 3), "Diff none") + } + } } |