summaryrefslogtreecommitdiff
path: root/test/files/run/bitsets.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-05-09 03:53:41 +0000
committerPaul Phillips <paulp@improving.org>2009-05-09 03:53:41 +0000
commit2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2 (patch)
tree9bb2044c595fe260c352a00cf98bb2ecece50437 /test/files/run/bitsets.scala
parentf7ab13b08e085c3bf94d857fc9648ee724e4cb08 (diff)
downloadscala-2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2.tar.gz
scala-2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2.tar.bz2
scala-2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2.zip
Organized disabled directory so it works with p...
Organized disabled directory so it works with partest. You can run ./partest --srcpath disabled to run the tests in that location. Fixed a few tests in disabled and pending and moved to files.
Diffstat (limited to 'test/files/run/bitsets.scala')
-rw-r--r--test/files/run/bitsets.scala78
1 files changed, 78 insertions, 0 deletions
diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala
new file mode 100644
index 0000000000..abe3d18501
--- /dev/null
+++ b/test/files/run/bitsets.scala
@@ -0,0 +1,78 @@
+//############################################################################
+// Bitsets
+//############################################################################
+// $Id$
+
+//############################################################################
+
+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.toList)
+ Console.println("ma1 = " + ms1.toList)
+ Console.println("ma2 = " + ms2.toList)
+
+ Console.println("mi0 = " + ms0.toImmutable)
+ Console.println("mi1 = " + ms1.toImmutable)
+ Console.println("mi2 = " + ms2.toImmutable)
+ Console.println
+}
+
+object TestImmutable {
+ import scala.collection.immutable.BitSet
+
+ val is0 = BitSet()
+ val is1 = BitSet.fromArray(Array())
+ val is2 = BitSet.fromArray(Array(4))
+ val is3 = BitSet.empty
+
+ Console.println("is0 = " + is0)
+ Console.println("is1 = " + is1)
+ Console.println("is2 = " + is2)
+ Console.println("is3 = " + is3)
+
+ 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("ys0 = " + is0.elements.toList)
+ Console.println("ys1 = " + is1.elements.toList)
+ Console.println("ys2 = " + is2.elements.toList)
+ Console.println("ys3 = " + is3.elements.toList)
+
+ Console.println("ia0 = " + is0.toList)
+ Console.println("ia1 = " + is1.toList)
+ Console.println("ia2 = " + is2.toList)
+ Console.println("ia3 = " + is3.toList)
+ Console.println
+}
+
+object Test extends Application {
+ TestMutable
+ TestImmutable
+}
+
+//############################################################################