From f81e2b1e54a51895e3dc2d72bf1de89f63c3e4a7 Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Aug 2024 00:15:01 +0200 Subject: [PATCH] Tue 27 Aug 00:14:56 CEST 2024 --- test/test-sh1.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/test-sh1.js diff --git a/test/test-sh1.js b/test/test-sh1.js new file mode 100644 index 0000000..b8ba36c --- /dev/null +++ b/test/test-sh1.js @@ -0,0 +1,21 @@ +// Simple jamsh test creating and starting hello world agent + +function agent(msg) { + this.msg=msg; + this.act = { + init : function () { log('Starting hello '+this.msg) }, + wait: function () { log('Sleeping'); sleep(1000) }, + end: function () { if (random(1)) throw "test exception"; /* not reached */ + log('Terminating'); + kill() } + } + this.trans = { + init: wait, + wait: function () { return random(1)?init:end } + } + this.next = init +} + +compile(agent) +create('agent','world') +start()