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()