diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/jvm/replyablereactor2.check | 5 | ||||
-rw-r--r-- | test/files/jvm/replyablereactor2.scala | 45 | ||||
-rw-r--r-- | test/files/jvm/replyablereactor3.check | 5 | ||||
-rw-r--r-- | test/files/jvm/replyablereactor3.scala | 44 | ||||
-rw-r--r-- | test/files/jvm/replyablereactor4.check | 5 | ||||
-rw-r--r-- | test/files/jvm/replyablereactor4.scala | 44 |
6 files changed, 148 insertions, 0 deletions
diff --git a/test/files/jvm/replyablereactor2.check b/test/files/jvm/replyablereactor2.check new file mode 100644 index 0000000000..0944b17279 --- /dev/null +++ b/test/files/jvm/replyablereactor2.check @@ -0,0 +1,5 @@ +'hello +'hello +'hello +'hello +'hello diff --git a/test/files/jvm/replyablereactor2.scala b/test/files/jvm/replyablereactor2.scala new file mode 100644 index 0000000000..6f0b43175d --- /dev/null +++ b/test/files/jvm/replyablereactor2.scala @@ -0,0 +1,45 @@ +import scala.actors._ +import scala.actors.Actor._ + +class MyActor extends ReplyReactor with ReplyableReactor { + def act() { + loop { + react { + case 'hello => + sender ! 'hello + case 'stop => + exit() + } + } + } +} + +object Test { + def main(args: Array[String]) { + val a = new MyActor + a.start() + + val b = new Reactor { + def act() { + react { + case r: MyActor => + var i = 0 + loop { + i += 1 + val ft = r !! 'hello + val msg = ft() + if (i % 10000 == 0) + println(msg) + if (i >= 50000) { + r ! 'stop + exit() + } + } + } + } + } + b.start() + + b ! a + } +} diff --git a/test/files/jvm/replyablereactor3.check b/test/files/jvm/replyablereactor3.check new file mode 100644 index 0000000000..0944b17279 --- /dev/null +++ b/test/files/jvm/replyablereactor3.check @@ -0,0 +1,5 @@ +'hello +'hello +'hello +'hello +'hello diff --git a/test/files/jvm/replyablereactor3.scala b/test/files/jvm/replyablereactor3.scala new file mode 100644 index 0000000000..6a646731d8 --- /dev/null +++ b/test/files/jvm/replyablereactor3.scala @@ -0,0 +1,44 @@ +import scala.actors._ +import scala.actors.Actor._ + +class MyActor extends ReplyReactor with ReplyableReactor { + def act() { + loop { + react { + case 'hello => + sender ! 'hello + case 'stop => + exit() + } + } + } +} + +object Test { + def main(args: Array[String]) { + val a = new MyActor + a.start() + + val b = new Reactor { + def act() { + react { + case r: MyActor => + var i = 0 + loop { + i += 1 + val msg = r !? 'hello + if (i % 10000 == 0) + println(msg) + if (i >= 50000) { + r ! 'stop + exit() + } + } + } + } + } + b.start() + + b ! a + } +} diff --git a/test/files/jvm/replyablereactor4.check b/test/files/jvm/replyablereactor4.check new file mode 100644 index 0000000000..cac0fffe3b --- /dev/null +++ b/test/files/jvm/replyablereactor4.check @@ -0,0 +1,5 @@ +Some('hello) +Some('hello) +Some('hello) +Some('hello) +Some('hello) diff --git a/test/files/jvm/replyablereactor4.scala b/test/files/jvm/replyablereactor4.scala new file mode 100644 index 0000000000..f09e32e356 --- /dev/null +++ b/test/files/jvm/replyablereactor4.scala @@ -0,0 +1,44 @@ +import scala.actors._ +import scala.actors.Actor._ + +class MyActor extends ReplyReactor with ReplyableReactor { + def act() { + loop { + react { + case 'hello => + sender ! 'hello + case 'stop => + exit() + } + } + } +} + +object Test { + def main(args: Array[String]) { + val a = new MyActor + a.start() + + val b = new Reactor { + def act() { + react { + case r: MyActor => + var i = 0 + loop { + i += 1 + val msg = r !? (500, 'hello) + if (i % 10000 == 0) + println(msg) + if (i >= 50000) { + r ! 'stop + exit() + } + } + } + } + } + b.start() + + b ! a + } +} |