From f6d60aaa17b7b97b7a09290eda29cd06115e5972 Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Aug 2024 00:15:15 +0200 Subject: [PATCH] Tue 27 Aug 00:14:56 CEST 2024 --- test/test-fork-subclass.js | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 test/test-fork-subclass.js diff --git a/test/test-fork-subclass.js b/test/test-fork-subclass.js new file mode 100644 index 0000000..8564199 --- /dev/null +++ b/test/test-fork-subclass.js @@ -0,0 +1,53 @@ +function master(xy) { + this.data=xy; + this.z=0; + this.child=null; + this.act = { + start : () => { + log('start'); + this.child = create({ + z:0, + data:{ + x:random(1,50), + y:random(1,50) + }, + act : [compA,end], + trans : { + start:compA + } + }) + log(this.child) + }, + compA: () => { + this.z=this.data.x+this.data.y; + log('z='+this.z) + }, + compB: () => { + this.z=this.data.x*this.data.y; + log('z='+this.z); + }, + end : () => { + log(keys(this)) + log(keys(this.act)) + log(keys(this.trans)) + if (this.on) log(keys(this.on)) + kill() + } + } + this.trans = { + start:() => { + return this.data.x<10 && this.data.y<10?compB:compA + }, + compA:end, + compB:end + } + this.on = { + SIG1: () => { + log('got SIG1') + } + } + this.next=start +} +compile(master) +create('master',{x:5,y:7}) +start()