diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-04-10 00:08:19 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-11-10 18:03:23 +0100 |
commit | e2c8e84d0243f6b672f21c8b6281cbef61b8b760 (patch) | |
tree | 6fb0b528435c7b399e65cfbfb651be7fc5baac10 /Scala/funsets/src/test | |
parent | c5f1113df8159078ac3bfb6fbe8426db72248512 (diff) | |
download | coursera-e2c8e84d0243f6b672f21c8b6281cbef61b8b760.zip coursera-e2c8e84d0243f6b672f21c8b6281cbef61b8b760.tar.gz |
Scala : week2: implement filter
Diffstat (limited to 'Scala/funsets/src/test')
-rw-r--r-- | Scala/funsets/src/test/scala/funsets/FunSetSuite.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala b/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala index 88dac91..7c3fd53 100644 --- a/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala +++ b/Scala/funsets/src/test/scala/funsets/FunSetSuite.scala @@ -162,4 +162,19 @@ class FunSetSuite extends FunSuite { assert(!contains(s, 3), "Diff none") } } + + test("filter") { + new TestSets { + val s = filter(s1, (x => x == 1)) + assert(!contains(s, 0), "Filter none") + assert(contains(s, 1), "Filter 1") + assert(!contains(s, 2), "Filter none") + assert(!contains(s, 3), "Filter none") + val v = filter(s1, (x => x == 0)) + assert(!contains(v, 0), "Filter none") + assert(!contains(v, 1), "Filter none") + assert(!contains(v, 2), "Filter none") + assert(!contains(v, 3), "Filter none") + } + } } |