diff options
author | michelou <michelou@epfl.ch> | 2007-03-08 14:58:02 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-03-08 14:58:02 +0000 |
commit | 8514f85695a5ec0fd179d4304b071e249fa4ab3b (patch) | |
tree | 16e75f84faddb36d51ecb6374f9a076d2b18c984 /test/files | |
parent | 60d600e1a14d3cc9c099a9c3a69d0f3b94c3544d (diff) | |
download | scala-8514f85695a5ec0fd179d4304b071e249fa4ab3b.tar.gz scala-8514f85695a5ec0fd179d4304b071e249fa4ab3b.tar.bz2 scala-8514f85695a5ec0fd179d4304b071e249fa4ab3b.zip |
added more test cases for class BitSet
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/bitsets.check | 35 | ||||
-rw-r--r-- | test/files/run/bitsets.scala | 74 |
2 files changed, 87 insertions, 22 deletions
diff --git a/test/files/run/bitsets.check b/test/files/run/bitsets.check index 31b718b19d..e9e6df08ad 100644 --- a/test/files/run/bitsets.check +++ b/test/files/run/bitsets.check @@ -1,9 +1,30 @@ -s0 = Set() -s1 = Set(2) -s2 = Set(2) -xs0 = List() +ms0 = Set(2) +ms1 = Set(2) +ms2 = Set(2) +mb0 = false +mb1 = false +mb2 = false +xs0 = List(2) xs1 = List(2) xs2 = List(2) -ys0 = List(0) -ys1 = List(4) -ys2 = List(4) +ma0 = List(4) +ma1 = List(4) +ma2 = List(4) + +is0 = Set() +is1 = Set() +is2 = Set(2) +is3 = Set() +ib0 = false +ib1 = false +ib2 = false +ib3 = false +ys0 = List() +ys1 = List() +ys2 = List(2) +ys3 = List() +ia0 = List(0) +ia1 = List(0) +ia2 = List(4) +ia3 = List() + diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala index 3b27bf7629..d296b81bd3 100644 --- a/test/files/run/bitsets.scala +++ b/test/files/run/bitsets.scala @@ -5,26 +5,70 @@ //############################################################################ -object Test extends Application { - import scala.collection.mutable.{BitSet => MBitSet} +object TestMutable { + import scala.collection.mutable.BitSet + + val ms0 = new BitSet + val ms1 = new BitSet(8) + val ms2 = new BitSet(0) + ms0 += 2 + ms1 ++= List(1, 2) + ms1 -= 1 + ms1 --= List(1) + ms2(2) = true + ms2(3) = false + + Console.println("ms0 = " + ms0) + Console.println("ms1 = " + ms1) + Console.println("ms2 = " + ms2) + + Console.println("mb0 = " + ms0.contains(-1)) + Console.println("mb1 = " + ms1.contains(2)) + Console.println("mb2 = " + ms2.contains(3)) + + Console.println("xs0 = " + ms0.elements.toList) + Console.println("xs1 = " + ms1.elements.toList) + Console.println("xs2 = " + ms2.elements.toList) + + Console.println("ma0 = " + ms0.toArray.toList) + Console.println("ma1 = " + ms1.toArray.toList) + Console.println("ma2 = " + ms2.toArray.toList) + Console.println +} + +object TestImmutable { import scala.collection.immutable.BitSet - val s0 = new BitSet(8, 8, null, false) - val s1 = new MBitSet(8) - val s2 = new BitSet(8, 8, Array(4), false) - s1 += 2 + val is0 = new BitSet(8, 1, null, false) + val is1 = new BitSet(8, 1, Array(), false) + val is2 = new BitSet(8, 8, Array(4), false) + val is3 = new BitSet(0, 0, null, false) + + Console.println("is0 = " + is0) + Console.println("is1 = " + is1) + Console.println("is2 = " + is2) + Console.println("is3 = " + is3) - Console.println("s0 = " + s0) - Console.println("s1 = " + s1) - Console.println("s2 = " + s2) + Console.println("ib0 = " + is0.contains(-1)) + Console.println("ib1 = " + is1.contains(0)) + Console.println("ib2 = " + is2.contains(2)) + Console.println("ib3 = " + is3.contains(2)) - Console.println("xs0 = " + s0.elements.toList) - Console.println("xs1 = " + s1.elements.toList) - Console.println("xs2 = " + s2.elements.toList) + Console.println("ys0 = " + is0.elements.toList) + Console.println("ys1 = " + is1.elements.toList) + Console.println("ys2 = " + is2.elements.toList) + Console.println("ys3 = " + is3.elements.toList) - Console.println("ys0 = " + s0.toArray.toList) - Console.println("ys1 = " + s1.toArray.toList) - Console.println("ys2 = " + s2.toArray.toList) + Console.println("ia0 = " + is0.toArray.toList) + Console.println("ia1 = " + is1.toArray.toList) + Console.println("ia2 = " + is2.toArray.toList) + Console.println("ia3 = " + is3.toArray.toList) + Console.println +} + +object Test extends Application { + TestMutable + TestImmutable } //############################################################################ |