diff options
author | Aleksandar Prokopec <axel22@gmail.com> | 2012-02-01 19:54:50 +0100 |
---|---|---|
committer | Aleksandar Prokopec <axel22@gmail.com> | 2012-02-01 19:54:50 +0100 |
commit | 5fe2d8b109abf3ff3e2d82dd4f248200846795c3 (patch) | |
tree | b50c45368759198fdcd0521016138a3fd7019322 /test/files/run/ctries/main.scala | |
parent | 8aa87f15e3887dbeb1a39bfea002b56cf68c445a (diff) | |
download | scala-5fe2d8b109abf3ff3e2d82dd4f248200846795c3.tar.gz scala-5fe2d8b109abf3ff3e2d82dd4f248200846795c3.tar.bz2 scala-5fe2d8b109abf3ff3e2d82dd4f248200846795c3.zip |
Add the Ctrie concurrent map implementation.
Ctrie is a scalable concurrent map implementation that supports
constant time lock-free lazy snapshots.
Due to the well-known private volatile field problem, atomic
reference updaters cannot be used efficiently in Scala yet.
For this reason, 4 java files had to be included as well.
None of these pollute the namespace, as most of the classes
are private.
Unit tests and a scalacheck check is also included.
Diffstat (limited to 'test/files/run/ctries/main.scala')
-rw-r--r-- | test/files/run/ctries/main.scala | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/files/run/ctries/main.scala b/test/files/run/ctries/main.scala new file mode 100644 index 0000000000..8db7fcef54 --- /dev/null +++ b/test/files/run/ctries/main.scala @@ -0,0 +1,45 @@ + + + + + + + +object Test { + + def main(args: Array[String]) { + ConcurrentMapSpec.test() + IteratorSpec.test() + LNodeSpec.test() + SnapshotSpec.test() + } + +} + + +trait Spec { + + implicit def str2ops(s: String) = new { + def in[U](body: =>U) { + // just execute body + body + } + } + + implicit def any2ops(a: Any) = new { + def shouldEqual(other: Any) = assert(a == other) + } + + def evaluating[U](body: =>U) = new { + def shouldProduce[T <: Throwable: ClassManifest]() = { + var produced = false + try body + catch { + case e => if (e.getClass == implicitly[ClassManifest[T]].erasure) produced = true + } finally { + assert(produced, "Did not produce exception of type: " + implicitly[ClassManifest[T]]) + } + } + } + +} |