diff options
author | Paul Phillips <paulp@improving.org> | 2013-09-18 00:09:46 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-09-18 07:13:38 -0700 |
commit | f4267ccd96a9143c910c66a5b0436aaa64b7c9dc (patch) | |
tree | 174861715807c23ba332f78769a9f7e1377b7f02 /test/files/run/ctries-old/concmap.scala | |
parent | d45a3c8cc8e9f1d95d797d548a85abd8597f5bc7 (diff) | |
download | scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.tar.gz scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.tar.bz2 scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.zip |
Cull extraneous whitespace.
One last flurry with the broom before I leave you slobs to code
in your own filth. Eliminated all the trailing whitespace I
could manage, with special prejudice reserved for the test cases
which depended on the preservation of trailing whitespace.
Was reminded I cannot figure out how to eliminate the trailing
space on the "scala> " prompt in repl transcripts. At least
reduced the number of such empty prompts by trimming transcript
code on the way in.
Routed ConsoleReporter's "printMessage" through a trailing
whitespace stripping method which might help futureproof
against the future of whitespace diseases. Deleted the up-to-40
lines of trailing whitespace found in various library files.
It seems like only yesterday we performed whitespace surgery
on the whole repo. Clearly it doesn't stick very well. I suggest
it would work better to enforce a few requirements on the way in.
Diffstat (limited to 'test/files/run/ctries-old/concmap.scala')
-rw-r--r-- | test/files/run/ctries-old/concmap.scala | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/test/files/run/ctries-old/concmap.scala b/test/files/run/ctries-old/concmap.scala index fccd4bed3e..affc6fe294 100644 --- a/test/files/run/ctries-old/concmap.scala +++ b/test/files/run/ctries-old/concmap.scala @@ -6,17 +6,17 @@ import Test.Spec object ConcurrentMapSpec extends Spec { - + val initsz = 500 val secondsz = 750 - + def test() { "support put" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) assert(ct.put(new Wrap(i), i) == None) for (i <- 0 until initsz) assert(ct.put(new Wrap(i), -i) == Some(i)) } - + "support put if absent" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -25,7 +25,7 @@ object ConcurrentMapSpec extends Spec { for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), -i) == None) for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), i) == Some(-i)) } - + "support remove if mapped to a specific value" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -33,7 +33,7 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == true) for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == false) } - + "support replace if mapped to a specific value" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -42,7 +42,7 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i, -i - 2) == false) for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i, 0) == false) } - + "support replace if present" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -50,17 +50,17 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i) == Some(-i)) for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i) == None) } - + def assertEqual(a: Any, b: Any) = { if (a != b) println(a, b) assert(a == b) } - + "support replace if mapped to a specific value, using several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 55000 for (i <- 0 until sz) ct.update(new Wrap(i), i) - + class Updater(index: Int, offs: Int) extends Thread { override def run() { var repeats = 0 @@ -75,24 +75,24 @@ object ConcurrentMapSpec extends Spec { //println("Thread %d repeats: %d".format(index, repeats)) } } - + val threads = for (i <- 0 until 16) yield new Updater(i, sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), i) - + val threads2 = for (i <- 0 until 15) yield new Updater(i, sz / 32 * i) threads2.foreach(_.start()) threads2.foreach(_.join()) - + for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), -i) } - + "support put if absent, several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 110000 - + class Updater(offs: Int) extends Thread { override def run() { for (i <- 0 until sz) { @@ -102,19 +102,19 @@ object ConcurrentMapSpec extends Spec { } } } - + val threads = for (i <- 0 until 16) yield new Updater(sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assert(ct(new Wrap(i)) == i) } - + "support remove if mapped to a specific value, several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 55000 for (i <- 0 until sz) ct.update(new Wrap(i), i) - + class Remover(offs: Int) extends Thread { override def run() { for (i <- 0 until sz) { @@ -124,19 +124,19 @@ object ConcurrentMapSpec extends Spec { } } } - + val threads = for (i <- 0 until 16) yield new Remover(sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assert(ct.get(new Wrap(i)) == None) } - + "have all or none of the elements depending on the oddity" in { val ct = new TrieMap[Wrap, Int] val sz = 65000 for (i <- 0 until sz) ct(new Wrap(i)) = i - + class Modifier(index: Int, offs: Int) extends Thread { override def run() { for (j <- 0 until sz) { @@ -152,38 +152,38 @@ object ConcurrentMapSpec extends Spec { } } } - + def modify(n: Int) = { val threads = for (i <- 0 until n) yield new Modifier(i, sz / n * i) threads.foreach(_.start()) threads.foreach(_.join()) } - + modify(16) for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), Some(i)) modify(15) for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), None) } - + "compute size correctly" in { val ct = new TrieMap[Wrap, Int] val sz = 36450 for (i <- 0 until sz) ct(new Wrap(i)) = i - + assertEqual(ct.size, sz) assertEqual(ct.size, sz) } - + "compute size correctly in parallel" in { val ct = new TrieMap[Wrap, Int] val sz = 36450 for (i <- 0 until sz) ct(new Wrap(i)) = i val pct = ct.par - + assertEqual(pct.size, sz) assertEqual(pct.size, sz) } - + } - + } |