diff --git a/test/fixtures/execute/README.md b/test/fixtures/execute/README.md index 140d6a95f6e..08b8ed34951 100644 --- a/test/fixtures/execute/README.md +++ b/test/fixtures/execute/README.md @@ -1,3 +1,5 @@ Tests in this folder are run in scratch by integration/execute.js. The tests can SAY test messages that map to tap methods. Read integration/execute.js for more. Tests whose names start with `tw-` are added by TurboWarp. Some of these tests are based on real projects from the scratch.mit.edu website, in which case their filename contains the original project ID and additional credits are within the project's scripts. We believe our use of these projects is fair use as the projects have been sufficiently modified and stripped down such that the project found here bears not even a slight resemblance to the original project. + +Tests whose names start with `forkphorus-` were imported from https://github.com/forkphorus/forkphorus/tree/master/tests. There is a fair bit of test case sharing between forkphorus and TurboWarp. diff --git a/test/fixtures/execute/forkphorus-105-contains.sb3 b/test/fixtures/execute/forkphorus-105-contains.sb3 new file mode 100644 index 00000000000..57395526bd4 Binary files /dev/null and b/test/fixtures/execute/forkphorus-105-contains.sb3 differ diff --git a/test/fixtures/execute/forkphorus-112.sb3 b/test/fixtures/execute/forkphorus-112.sb3 new file mode 100644 index 00000000000..9495da234a6 Binary files /dev/null and b/test/fixtures/execute/forkphorus-112.sb3 differ diff --git a/test/fixtures/execute/forkphorus-263-NaN.sb3 b/test/fixtures/execute/forkphorus-263-NaN.sb3 new file mode 100644 index 00000000000..56fd1c7684c Binary files /dev/null and b/test/fixtures/execute/forkphorus-263-NaN.sb3 differ diff --git a/test/fixtures/execute/forkphorus-264-setCostume.sb3 b/test/fixtures/execute/forkphorus-264-setCostume.sb3 new file mode 100644 index 00000000000..aabebd1ac6b Binary files /dev/null and b/test/fixtures/execute/forkphorus-264-setCostume.sb3 differ diff --git a/test/fixtures/execute/forkphorus-285-variable-id-name-desync.sb3 b/test/fixtures/execute/forkphorus-285-variable-id-name-desync.sb3 new file mode 100644 index 00000000000..4f622113ac8 Binary files /dev/null and b/test/fixtures/execute/forkphorus-285-variable-id-name-desync.sb3 differ diff --git a/test/fixtures/execute/forkphorus-56-NaN.sb3 b/test/fixtures/execute/forkphorus-56-NaN.sb3 new file mode 100644 index 00000000000..5f462a079d9 Binary files /dev/null and b/test/fixtures/execute/forkphorus-56-NaN.sb3 differ diff --git a/test/fixtures/execute/forkphorus-58-list-reference.sb3 b/test/fixtures/execute/forkphorus-58-list-reference.sb3 new file mode 100644 index 00000000000..e32f56124b1 Binary files /dev/null and b/test/fixtures/execute/forkphorus-58-list-reference.sb3 differ diff --git a/test/fixtures/execute/forkphorus-66-insert.sb3 b/test/fixtures/execute/forkphorus-66-insert.sb3 new file mode 100644 index 00000000000..b9b3011a6cc Binary files /dev/null and b/test/fixtures/execute/forkphorus-66-insert.sb3 differ diff --git a/test/fixtures/execute/forkphorus-70.sb3 b/test/fixtures/execute/forkphorus-70.sb3 new file mode 100644 index 00000000000..e65f034bca0 Binary files /dev/null and b/test/fixtures/execute/forkphorus-70.sb3 differ diff --git a/test/fixtures/execute/forkphorus-and-or-not-cast-to-boolean.sb3 b/test/fixtures/execute/forkphorus-and-or-not-cast-to-boolean.sb3 new file mode 100644 index 00000000000..86faf446673 Binary files /dev/null and b/test/fixtures/execute/forkphorus-and-or-not-cast-to-boolean.sb3 differ diff --git a/test/fixtures/execute/forkphorus-befunge-eratosthenes.sb3 b/test/fixtures/execute/forkphorus-befunge-eratosthenes.sb3 new file mode 100644 index 00000000000..cb359719bca Binary files /dev/null and b/test/fixtures/execute/forkphorus-befunge-eratosthenes.sb3 differ diff --git a/test/fixtures/execute/forkphorus-broadcast-self-restart-delay.sb3 b/test/fixtures/execute/forkphorus-broadcast-self-restart-delay.sb3 new file mode 100644 index 00000000000..41dd6ec091d Binary files /dev/null and b/test/fixtures/execute/forkphorus-broadcast-self-restart-delay.sb3 differ diff --git a/test/fixtures/execute/forkphorus-cannot-forceQueue-after-broadcast.sb3 b/test/fixtures/execute/forkphorus-cannot-forceQueue-after-broadcast.sb3 new file mode 100644 index 00000000000..14e9b8d6e82 Binary files /dev/null and b/test/fixtures/execute/forkphorus-cannot-forceQueue-after-broadcast.sb3 differ diff --git a/test/fixtures/execute/forkphorus-change-size-NaN.sb3 b/test/fixtures/execute/forkphorus-change-size-NaN.sb3 new file mode 100644 index 00000000000..21ac1302eca Binary files /dev/null and b/test/fixtures/execute/forkphorus-change-size-NaN.sb3 differ diff --git a/test/fixtures/execute/forkphorus-costume-name-infinity-nan.sb3 b/test/fixtures/execute/forkphorus-costume-name-infinity-nan.sb3 new file mode 100644 index 00000000000..57c02383845 Binary files /dev/null and b/test/fixtures/execute/forkphorus-costume-name-infinity-nan.sb3 differ diff --git a/test/fixtures/execute/forkphorus-for-each-in.sb3 b/test/fixtures/execute/forkphorus-for-each-in.sb3 new file mode 100644 index 00000000000..2f8ab49747f Binary files /dev/null and b/test/fixtures/execute/forkphorus-for-each-in.sb3 differ diff --git a/test/fixtures/execute/forkphorus-glide-negative-time.sb3 b/test/fixtures/execute/forkphorus-glide-negative-time.sb3 new file mode 100644 index 00000000000..68fc0b05373 Binary files /dev/null and b/test/fixtures/execute/forkphorus-glide-negative-time.sb3 differ diff --git a/test/fixtures/execute/forkphorus-glide-xy-NaN.sb3 b/test/fixtures/execute/forkphorus-glide-xy-NaN.sb3 new file mode 100644 index 00000000000..1729ddb7cba Binary files /dev/null and b/test/fixtures/execute/forkphorus-glide-xy-NaN.sb3 differ diff --git a/test/fixtures/execute/forkphorus-mathop-NaN.sb3 b/test/fixtures/execute/forkphorus-mathop-NaN.sb3 new file mode 100644 index 00000000000..51543d05b9a Binary files /dev/null and b/test/fixtures/execute/forkphorus-mathop-NaN.sb3 differ diff --git a/test/fixtures/execute/forkphorus-negative-zero.sb3 b/test/fixtures/execute/forkphorus-negative-zero.sb3 new file mode 100644 index 00000000000..c2f45e0850f Binary files /dev/null and b/test/fixtures/execute/forkphorus-negative-zero.sb3 differ diff --git a/test/fixtures/execute/forkphorus-operators-output-NaN.sb3 b/test/fixtures/execute/forkphorus-operators-output-NaN.sb3 new file mode 100644 index 00000000000..1e3e9787e1a Binary files /dev/null and b/test/fixtures/execute/forkphorus-operators-output-NaN.sb3 differ diff --git a/test/fixtures/execute/forkphorus-operators.sb3 b/test/fixtures/execute/forkphorus-operators.sb3 new file mode 100644 index 00000000000..71a67586838 Binary files /dev/null and b/test/fixtures/execute/forkphorus-operators.sb3 differ diff --git a/test/fixtures/execute/forkphorus-preserve-order-after-stop-other-scripts.sb3 b/test/fixtures/execute/forkphorus-preserve-order-after-stop-other-scripts.sb3 new file mode 100644 index 00000000000..9c9a6e0e451 Binary files /dev/null and b/test/fixtures/execute/forkphorus-preserve-order-after-stop-other-scripts.sb3 differ diff --git a/test/fixtures/execute/forkphorus-procedure-definition-order.sb3 b/test/fixtures/execute/forkphorus-procedure-definition-order.sb3 new file mode 100644 index 00000000000..77cc6ff3c8e Binary files /dev/null and b/test/fixtures/execute/forkphorus-procedure-definition-order.sb3 differ diff --git a/test/fixtures/execute/forkphorus-run-blocks-after-self-broadcast.sb3 b/test/fixtures/execute/forkphorus-run-blocks-after-self-broadcast.sb3 new file mode 100644 index 00000000000..444a7addba6 Binary files /dev/null and b/test/fixtures/execute/forkphorus-run-blocks-after-self-broadcast.sb3 differ diff --git a/test/fixtures/execute/forkphorus-scripts-run-after-stop-all.sb3 b/test/fixtures/execute/forkphorus-scripts-run-after-stop-all.sb3 new file mode 100644 index 00000000000..8c2529ea7ab Binary files /dev/null and b/test/fixtures/execute/forkphorus-scripts-run-after-stop-all.sb3 differ diff --git a/test/fixtures/execute/forkphorus-stop-other-scripts-in-sprite.sb3 b/test/fixtures/execute/forkphorus-stop-other-scripts-in-sprite.sb3 new file mode 100644 index 00000000000..4c58490b0cb Binary files /dev/null and b/test/fixtures/execute/forkphorus-stop-other-scripts-in-sprite.sb3 differ diff --git a/test/fixtures/execute/forkphorus-string-functions.sb3 b/test/fixtures/execute/forkphorus-string-functions.sb3 new file mode 100644 index 00000000000..bfdbc4b14b9 Binary files /dev/null and b/test/fixtures/execute/forkphorus-string-functions.sb3 differ diff --git a/test/fixtures/execute/forkphorus-tangent.sb3 b/test/fixtures/execute/forkphorus-tangent.sb3 new file mode 100644 index 00000000000..3936fabe701 Binary files /dev/null and b/test/fixtures/execute/forkphorus-tangent.sb3 differ diff --git a/test/snapshot/__snapshots__/forkphorus-105-contains.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-105-contains.sb3.tw-snapshot new file mode 100644 index 00000000000..ba4fc637e92 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-105-contains.sb3.tw-snapshot @@ -0,0 +1,45 @@ +// TW Snapshot +// Input SHA-256: d641b68a89119171eff5d36de1bd4f59b1649acc5ae55803fb0b797b636f52bb + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"](("apple".toLowerCase().indexOf("aPPle".toLowerCase()) !== -1),"apple contains aPPle"); +yield* thread.procedures["ZassertTrue %b %s"](("APPLE".toLowerCase().indexOf("app".toLowerCase()) !== -1),"APPLE contains app"); +yield* thread.procedures["ZassertTrue %b %s"](("appLe".toLowerCase().indexOf("LE".toLowerCase()) !== -1),"appLe contains LE"); +yield* thread.procedures["ZOK %s"]("ok"); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "j", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "n", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "p", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-112.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-112.sb3.tw-snapshot new file mode 100644 index 00000000000..babf8baf6d1 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-112.sb3.tw-snapshot @@ -0,0 +1,45 @@ +// TW Snapshot +// Input SHA-256: ff616461f1a16504b3a7be65eeecfdd29d31e897c43157fbd51370f72458852d + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +runtime.ext_scratch3_looks._setCostume(target, "costume2"); +runtime.ext_scratch3_looks._setCostume(target, (" " + "")); +yield* thread.procedures["ZassertTrue %b %s"](((target.currentCostume + 1) === 2),"costume should not change"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "j", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "n", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "c", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "p", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-263-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-263-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..acc5b25aebf --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-263-NaN.sb3.tw-snapshot @@ -0,0 +1,48 @@ +// TW Snapshot +// Input SHA-256: 67ab3b26c771f54d4181fa85a76430fdb4603a171c36a918cce1374c89bf9c23 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["rL_u6{W`ET;GKBRHZrag"]; +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"]((("" + (0 / 0)).toLowerCase() === "NaN".toLowerCase()),"0/0"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual((0 / 0), (0 / 0)),"NaN == NaN"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(Math.sqrt(-100), (0 / 0)),"sqrt negative"); +b0.value = (0 / 0); +yield* thread.procedures["ZassertTrue %b %s"]((("" + b0.value).toLowerCase() === "NaN".toLowerCase()),"NaN storable in variables"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "n", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "p", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "r", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "t", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-264-setCostume.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-264-setCostume.sb3.tw-snapshot new file mode 100644 index 00000000000..1bc3f57e06e --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-264-setCostume.sb3.tw-snapshot @@ -0,0 +1,75 @@ +// TW Snapshot +// Input SHA-256: 801a8e9ac5e607f022601f2eda4bddf37b29c30627f0e24864c7b0f9cf7b65f9 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["G3sNM{+Wa29PviNsXl~;"]; +return function* genXYZ () { +b0.value = "4"; +runtime.ext_scratch3_looks._setCostume(target, b0.value); +yield* thread.procedures["ZassertTrue %b %s"](((+target.getCostumes()[target.currentCostume].name || 0) === 4),"cn=4"); +yield* thread.procedures["ZassertTrue %b %s"](((target.currentCostume + 1) === 2),"c#=2"); +b0.value = 3; +runtime.ext_scratch3_looks._setCostume(target, b0.value); +yield* thread.procedures["ZassertTrue %b %s"]((target.getCostumes()[target.currentCostume].name.toLowerCase() === "costume3".toLowerCase()),"cn=costume3"); +yield* thread.procedures["ZassertTrue %b %s"](((target.currentCostume + 1) === 3),"c#=3"); +b0.value = ("" + "4"); +runtime.ext_scratch3_looks._setCostume(target, b0.value); +yield* thread.procedures["ZassertTrue %b %s"](((+target.getCostumes()[target.currentCostume].name || 0) === 4),"cn=4"); +yield* thread.procedures["ZassertTrue %b %s"](((target.currentCostume + 1) === 2),"c#=2"); +b0.value = (4 * 1); +runtime.ext_scratch3_looks._setCostume(target, b0.value); +yield* thread.procedures["ZassertTrue %b %s"]((target.getCostumes()[target.currentCostume].name.toLowerCase() === "costume4".toLowerCase()),"cn=costume4"); +yield* thread.procedures["ZassertTrue %b %s"](((target.currentCostume + 1) === 4),"c#=4"); +b0.value = "4"; +runtime.ext_scratch3_looks._setBackdrop(stage, b0.value); +yield* thread.procedures["ZassertTrue %b %s"](((+stage.getCostumes()[stage.currentCostume].name || 0) === 4),"bn=4"); +yield* thread.procedures["ZassertTrue %b %s"](((stage.currentCostume + 1) === 2),"b#=2"); +b0.value = 3; +runtime.ext_scratch3_looks._setBackdrop(stage, b0.value); +yield* thread.procedures["ZassertTrue %b %s"]((stage.getCostumes()[stage.currentCostume].name.toLowerCase() === "backdrop3".toLowerCase()),"cn=backdrop3"); +yield* thread.procedures["ZassertTrue %b %s"](((stage.currentCostume + 1) === 3),"c#=3"); +b0.value = ("" + "4"); +runtime.ext_scratch3_looks._setBackdrop(stage, b0.value); +yield* thread.procedures["ZassertTrue %b %s"](((+stage.getCostumes()[stage.currentCostume].name || 0) === 4),"bn=4"); +yield* thread.procedures["ZassertTrue %b %s"](((stage.currentCostume + 1) === 2),"b#=2"); +b0.value = (4 * 1); +runtime.ext_scratch3_looks._setBackdrop(stage, b0.value); +yield* thread.procedures["ZassertTrue %b %s"]((stage.getCostumes()[stage.currentCostume].name.toLowerCase() === "backdrop4".toLowerCase()),"bn=backdrop4"); +yield* thread.procedures["ZassertTrue %b %s"](((stage.currentCostume + 1) === 4),"b#=4"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "I", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "K", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "M", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "O", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-285-variable-id-name-desync.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-285-variable-id-name-desync.sb3.tw-snapshot new file mode 100644 index 00000000000..95718123ec2 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-285-variable-id-name-desync.sb3.tw-snapshot @@ -0,0 +1,44 @@ +// TW Snapshot +// Input SHA-256: 1accbfd57a291524a062413a9c361d51e94ac5555fd3d861dd2d56806cd7e8c7 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["T{7z:Z^j(zfah+5ca3R0"]; +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 33),"uses ID"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "h", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "j", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "l", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "n", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-56-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-56-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..c19a254e669 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-56-NaN.sb3.tw-snapshot @@ -0,0 +1,47 @@ +// TW Snapshot +// Input SHA-256: 930b81005746fcf09490be69206cf92f6b882a8d4d66ef9cfa19139090131aad + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"]((((5 + (+("" + "+") || 0)) || 0) === 5),1); +yield* thread.procedures["ZassertTrue %b %s"]((((5 + (+("" + "-") || 0)) || 0) === 5),2); +yield* thread.procedures["ZassertTrue %b %s"]((((5 + (+("" + "x") || 0)) || 0) === 5),3); +yield* thread.procedures["ZassertTrue %b %s"]((((5 + (+("" + "-=-2398749") || 0)) || 0) === 5),4); +yield* thread.procedures["ZassertTrue %b %s"]((((5 + (+("" + "") || 0)) || 0) === 5),5); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "A", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "g", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "C", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "l", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "n", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-58-list-reference.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-58-list-reference.sb3.tw-snapshot new file mode 100644 index 00000000000..7af7a095173 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-58-list-reference.sb3.tw-snapshot @@ -0,0 +1,60 @@ +// TW Snapshot +// Input SHA-256: 95f7dfd29f2a3aec8027d03eab202b439a7630a1ee6b9a7cf534c7d971e41ef7 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables[")@7t1F9WM1F[_jBWx]7["]; +const b1 = stage.variables[",VHjOaLurDh*^;8kZ~I?"]; +return function* genXYZ () { +b0.value = []; +b1.value = []; +b0.value.push(3); +b0._monitorUpToDate = false; +b0.value.push(2); +b0._monitorUpToDate = false; +b0.value.push(8); +b0._monitorUpToDate = false; +b0.value.push(4); +b0._monitorUpToDate = false; +b1.value.push(listContents(b0)); +b1._monitorUpToDate = false; +b0.value = []; +yield* thread.procedures["ZassertTrue %b %s"]((b1.value.length === 1),"output length = 1"); +yield* thread.procedures["ZassertTrue %b %s"]((b0.value.length === 0),"data length = 0"); +yield* thread.procedures["ZassertTrue %b %s"](((+(b1.value[1 - 1] ?? "") || 0) === 3284),"output item 1"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "j", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "n", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "p", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-66-insert.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-66-insert.sb3.tw-snapshot new file mode 100644 index 00000000000..874b944bb1d --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-66-insert.sb3.tw-snapshot @@ -0,0 +1,54 @@ +// TW Snapshot +// Input SHA-256: 6bac3cd99997a7deae133a560824b5dc3801b8e7e41ff3f9daab8fd6282f890f + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["$h5KnZ-ePA3NOi=];]FX"]; +return function* genXYZ () { +b0.value = []; +b0.value.unshift("a"); +b0._monitorUpToDate = false; +listInsert(b0, 2, "b"); +listInsert(b0, 3, "c"); +yield* thread.procedures["ZassertTrue %b %s"]((b0.value.length === 3),"length is 3"); +yield* thread.procedures["ZassertTrue %b %s"]((("" + (b0.value[1 - 1] ?? "")).toLowerCase() === "a".toLowerCase()),"1=a"); +yield* thread.procedures["ZassertTrue %b %s"]((("" + (b0.value[2 - 1] ?? "")).toLowerCase() === "b".toLowerCase()),"2=b"); +yield* thread.procedures["ZassertTrue %b %s"]((("" + (b0.value[3 - 1] ?? "")).toLowerCase() === "c".toLowerCase()),"3=c"); +b0.value = []; +yield* thread.procedures["ZassertTrue %b %s"]((b0.value.length === 0),"length is 0"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "l", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "n", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "p", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "r", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-70.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-70.sb3.tw-snapshot new file mode 100644 index 00000000000..ae6ab5f0f70 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-70.sb3.tw-snapshot @@ -0,0 +1,43 @@ +// TW Snapshot +// Input SHA-256: 25ae3486d45378eb1c50784721d62d71d790c4687871f5961f731f1880137db2 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"](compareEqual((("0123")[1 - 1] || ""), 0),"letter 1 of 0123 is 0"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "h", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "j", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "l", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "n", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-and-or-not-cast-to-boolean.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-and-or-not-cast-to-boolean.sb3.tw-snapshot new file mode 100644 index 00000000000..e1ae77aaba6 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-and-or-not-cast-to-boolean.sb3.tw-snapshot @@ -0,0 +1,27 @@ +// TW Snapshot +// Input SHA-256: 7bc7268ef7d0d00b445b003aa683b39bcdb3c4c1d4bb7ae03679f553ad22f5a6 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["q9l+ZDG${I3p$=:TPs`3"]; +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 3",}, b0, false, false, "f", null); +if ((("_" + ("" + (toBoolean((b1.value[2 - 1] ?? "")) && toBoolean((b1.value[2 - 1] ?? ""))))).toLowerCase() === "_true".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "m", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "n", null); +} +if ((("_" + ("" + (toBoolean((b1.value[1 - 1] ?? "")) || toBoolean((b1.value[2 - 1] ?? ""))))).toLowerCase() === "_true".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "q", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "r", null); +} +if (!toBoolean((b1.value[1 - 1] ?? ""))) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "v", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "w", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "u", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-befunge-eratosthenes.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-befunge-eratosthenes.sb3.tw-snapshot new file mode 100644 index 00000000000..0ade0f0368d --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-befunge-eratosthenes.sb3.tw-snapshot @@ -0,0 +1,437 @@ +// TW Snapshot +// Input SHA-256: 81139c5bfe7cf38a74769e99279d2d211e5acb5dbc301dbd2bae79a6676015a3 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +thread.procedures["Wcopy input"](); +yield* thread.procedures["Zbefunge"](); +retire(); return; +}; }) + +// Sprite1 Wcopy input +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-P-list"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-input-list"]; +return function funXYZ_copy_input () { +b0.value = []; +b1.value = 0; +for (var a0 = b2.value.length; a0 > 0; a0--) { +b1.value = (b1.value + 1); +b0.value.push((b2.value[b1.value - 1] ?? "")); +b0._monitorUpToDate = false; +} +return ""; +}; }) + +// Sprite1 Zbefunge +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-px-"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-py-"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-direction-"]; +const b3 = runtime.getSpriteTargetByName("directions"); +const b4 = b3 && b3.lookupVariableByNameAndType("RIGHT", "", true); +const b5 = stage.variables["o4+OyKx[M=quu6p{=kRl-mem-list"]; +const b6 = stage.variables["4s|,s}H*n$XE+1ez}%eC"]; +return function* genXYZ_befunge () { +b0.value = 1; +b1.value = 1; +b2.value = (b4 ? b4.value : 0); +b5.value = []; +b6.value = []; +thread.procedures["Wget max length"](); +while (true) { +yield* thread.procedures["Zstep"](); +yield; +} +return ""; +}; }) + +// Sprite1 Wget max length +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-max length-"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-input-list"]; +return function funXYZ_get_max_length () { +b0.value = 0; +b1.value = 0; +for (var a0 = b2.value.length; a0 > 0; a0--) { +b1.value = (b1.value + 1); +if ((("" + (b2.value[b1.value - 1] ?? "")).length > b0.value)) { +b0.value = ("" + (b2.value[b1.value - 1] ?? "")).length; +} +} +return ""; +}; }) + +// Sprite1 Zstep +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-char-"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-P-list"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-py-"]; +const b3 = stage.variables["o4+OyKx[M=quu6p{=kRl-px-"]; +const b4 = stage.variables["o4+OyKx[M=quu6p{=kRl-direction-"]; +const b5 = runtime.getSpriteTargetByName("directions"); +const b6 = b5 && b5.lookupVariableByNameAndType("RIGHT", "", true); +const b7 = b5 && b5.lookupVariableByNameAndType("LEFT", "", true); +const b8 = b5 && b5.lookupVariableByNameAndType("UP", "", true); +const b9 = b5 && b5.lookupVariableByNameAndType("DOWN", "", true); +const b10 = stage.variables["o4+OyKx[M=quu6p{=kRl-pop-list"]; +const b11 = stage.variables["o4+OyKx[M=quu6p{=kRl-result-"]; +const b12 = stage.variables["o4+OyKx[M=quu6p{=kRl-mem-list"]; +const b13 = stage.variables["4s|,s}H*n$XE+1ez}%eC"]; +const b14 = stage.variables["o4+OyKx[M=quu6p{=kRl-ascii-list"]; +const b15 = stage.variables["o4+OyKx[M=quu6p{=kRl-ascii2-list"]; +const b16 = stage.variables["o4+OyKx[M=quu6p{=kRl-numbers-list"]; +return function* genXYZ_step () { +b0.value = ((("" + listGet(b1.value, b2.value)))[((+b3.value) | 0) - 1] || ""); +if ((b0.value.toLowerCase() === ">".toLowerCase())) { +b4.value = (b6 ? b6.value : 0); +} +if ((b0.value.toLowerCase() === "<".toLowerCase())) { +b4.value = (b7 ? b7.value : 0); +} +if ((b0.value.toLowerCase() === "^".toLowerCase())) { +b4.value = (b8 ? b8.value : 0); +} +if ((b0.value.toLowerCase() === "v".toLowerCase())) { +b4.value = (b9 ? b9.value : 0); +} +if ((b0.value.toLowerCase() === "?".toLowerCase())) { +b4.value = randomInt(1, 4); +} +if ((b0.value.toLowerCase() === "@".toLowerCase())) { +yield* thread.procedures["Zexit & verify"](); +} +if ((("" + b0.value).toLowerCase() === "+".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"](((+(b10.value[1 - 1] ?? "") || 0) + (+(b10.value[2 - 1] ?? "") || 0))); +} +if ((("" + b0.value).toLowerCase() === "-".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"](((+(b10.value[2 - 1] ?? "") || 0) - (+(b10.value[1 - 1] ?? "") || 0))); +} +if ((("" + b0.value).toLowerCase() === "*".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"](((+(b10.value[2 - 1] ?? "") || 0) * (+(b10.value[1 - 1] ?? "") || 0))); +} +if ((("" + b0.value).toLowerCase() === "/".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"](Math.floor((((+(b10.value[2 - 1] ?? "") || 0) / (+(b10.value[1 - 1] ?? "") || 0)) || 0))); +} +if ((("" + b0.value).toLowerCase() === "%".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"](mod((+(b10.value[2 - 1] ?? "") || 0), (+(b10.value[1 - 1] ?? "") || 0))); +} +if ((("" + b0.value).toLowerCase() === "!".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +thread.procedures["Zpush bool %b"](compareEqual((b10.value[1 - 1] ?? ""), 0)); +} +if ((("" + b0.value).toLowerCase() === "`".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush bool %b"](compareGreaterThan((b10.value[2 - 1] ?? ""), (b10.value[1 - 1] ?? ""))); +} +if ((("" + b0.value).toLowerCase() === "_".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +if ((compareEqual((b10.value[1 - 1] ?? ""), 0) || (("" + (b10.value[1 - 1] ?? "")).toLowerCase() === "".toLowerCase()))) { +b4.value = (b6 ? b6.value : 0); +} else { +b4.value = (b7 ? b7.value : 0); +} +} +if ((("" + b0.value).toLowerCase() === "|".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +if ((compareEqual((b10.value[1 - 1] ?? ""), 0) || (("" + (b10.value[1 - 1] ?? "")).toLowerCase() === "".toLowerCase()))) { +b4.value = (b9 ? b9.value : 0); +} else { +b4.value = (b8 ? b8.value : 0); +} +} +if ((("" + b0.value).toLowerCase() === "\"".toLowerCase())) { +yield* thread.procedures["Znext char"](); +while (!(((("" + listGet(b1.value, b2.value)))[((+b3.value) | 0) - 1] || "").toLowerCase() === "\"".toLowerCase())) { +thread.procedures["Wascii to number %s"](((("" + listGet(b1.value, b2.value)))[((+b3.value) | 0) - 1] || "")); +thread.procedures["Zpush %n"](b11.value); +yield* thread.procedures["Znext char"](); +yield; +} +} +if ((("" + b0.value).toLowerCase() === ":".toLowerCase())) { +thread.procedures["Zpush %n"]((b12.value[b12.value.length - 1] ?? "")); +} +if ((("" + b0.value).toLowerCase() === "\\".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"]((b10.value[1 - 1] ?? "")); +thread.procedures["Zpush %n"]((b10.value[2 - 1] ?? "")); +} +if ((("" + b0.value).toLowerCase() === "$".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +} +if ((("" + b0.value).toLowerCase() === ".".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +b13.value.push((b10.value[1 - 1] ?? "")); +b13._monitorUpToDate = false; +} +if ((("" + b0.value).toLowerCase() === ",".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +yield* thread.procedures["ZFAIL %s"](("did not expect ascii output: " + ("" + (b14.value[(((+(b10.value[1 - 1] ?? "") || 0) + 1) | 0) - 1] ?? "")))); +} +if ((("" + b0.value).toLowerCase() === "#".toLowerCase())) { +yield* thread.procedures["Znext char"](); +} +if ((("" + b0.value).toLowerCase() === "g".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +yield* thread.procedures["Zascii to number but it lies %s"](((("" + (b1.value[(((+(b10.value[1 - 1] ?? "") || 0) + 1) | 0) - 1] ?? "")))[(((+(b10.value[2 - 1] ?? "") || 0) + 1) | 0) - 1] || "")); +thread.procedures["Zpush %n"](b11.value); +} +if ((("" + b0.value).toLowerCase() === "p".toLowerCase())) { +yield* thread.procedures["Zpop %n"](3); +listReplace(b10, 1, ((+(b10.value[1 - 1] ?? "") || 0) + 1)); +listReplace(b10, 2, ((+(b10.value[2 - 1] ?? "") || 0) + 1)); +if (compareLessThan(b1.value.length, (b10.value[1 - 1] ?? ""))) { +while (!compareEqual(b1.value.length, (b10.value[1 - 1] ?? ""))) { +b1.value.push(""); +b1._monitorUpToDate = false; +yield; +} +} +if (compareLessThan(("" + listGet(b1.value, (b10.value[1 - 1] ?? ""))).length, (b10.value[2 - 1] ?? ""))) { +while (!compareEqual(("" + listGet(b1.value, (b10.value[1 - 1] ?? ""))).length, (b10.value[2 - 1] ?? ""))) { +listReplace(b1, (b10.value[1 - 1] ?? ""), (("" + listGet(b1.value, (b10.value[1 - 1] ?? ""))) + " ")); +yield; +} +} +thread.procedures["Winsert %s %n %s"](listGet(b1.value, (b10.value[1 - 1] ?? "")),(b10.value[2 - 1] ?? ""),(b15.value[(((+(b10.value[3 - 1] ?? "") || 0) + 1) | 0) - 1] ?? "")); +listReplace(b1, (b10.value[1 - 1] ?? ""), b11.value); +} +if ((("" + b0.value).toLowerCase() === "&".toLowerCase())) { +yield* thread.procedures["ZFAIL %s"]("unexpected ask for integer input"); +} +if ((("" + b0.value).toLowerCase() === "~".toLowerCase())) { +yield* thread.procedures["ZFAIL %s"]("unexpected ask for ascii input"); +} +if (listContains(b16, b0.value)) { +thread.procedures["Zpush %n"](b0.value); +} +yield* thread.procedures["Znext char"](); +return ""; +}; }) + +// Sprite1 Zexit & verify +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["4s|,s}H*n$XE+1ez}%eC"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +const b2 = stage.variables["f]9Ph]^v5P2CT7ju($Qb"]; +return function* genXYZ_exit___verify () { +yield* thread.procedures["ZassertTrue %b %s"]((b0.value.length === 22),"should output 22 items"); +b1.value = 0; +for (var a0 = b0.value.length; a0 > 0; a0--) { +b1.value = ((+b1.value || 0) + 1); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(listGet(b0.value, b1.value), listGet(b2.value, b1.value)),("item " + (("" + b1.value) + " should match expected output"))); +yield; +} +yield* thread.procedures["ZOKAY %s"]((("" + runtime.ioDevices.clock.projectTimer()) + " seconds")); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 Zpop %n +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-pop-list"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-mem-list"]; +return function* genXYZ_pop_ (p0) { +b0.value = []; +for (var a0 = (+p0 || 0); a0 >= 0.5; a0--) { +if ((b1.value.length > 0)) { +b0.value.push((b1.value[b1.value.length - 1] ?? "")); +b0._monitorUpToDate = false; +b1.value.pop(); +b1._monitorUpToDate = false; +} else { +b0.value.push(0); +b0._monitorUpToDate = false; +} +yield; +} +return ""; +}; }) + +// Sprite1 Zpush %n +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-mem-list"]; +return function funXYZ_push_ (p0) { +b0.value.push(p0); +b0._monitorUpToDate = false; +return ""; +}; }) + +// Sprite1 Zpush bool %b +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function funXYZ_push_bool_ (p0) { +if (toBoolean(p0)) { +thread.procedures["Zpush %n"](1); +} else { +thread.procedures["Zpush %n"](0); +} +return ""; +}; }) + +// Sprite1 Znext char +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-direction-"]; +const b1 = runtime.getSpriteTargetByName("directions"); +const b2 = b1 && b1.lookupVariableByNameAndType("RIGHT", "", true); +const b3 = stage.variables["o4+OyKx[M=quu6p{=kRl-px-"]; +const b4 = b1 && b1.lookupVariableByNameAndType("LEFT", "", true); +const b5 = b1 && b1.lookupVariableByNameAndType("UP", "", true); +const b6 = stage.variables["o4+OyKx[M=quu6p{=kRl-py-"]; +const b7 = b1 && b1.lookupVariableByNameAndType("DOWN", "", true); +const b8 = runtime.getOpcodeFunction("sensing_askandwait"); +const b9 = stage.variables["o4+OyKx[M=quu6p{=kRl-P-list"]; +const b10 = stage.variables["o4+OyKx[M=quu6p{=kRl-max length-"]; +return function* genXYZ_next_char () { +if (compareEqual(b0.value, (b2 ? b2.value : 0))) { +b3.value = ((+b3.value || 0) + 1); +} else { +if (compareEqual(b0.value, (b4 ? b4.value : 0))) { +b3.value = ((+b3.value || 0) + -1); +} else { +if (compareEqual(b0.value, (b5 ? b5.value : 0))) { +b6.value = ((+b6.value || 0) + -1); +} else { +if (compareEqual(b0.value, (b7 ? b7.value : 0))) { +b6.value = ((+b6.value || 0) + 1); +} else { +yield* executeInCompatibilityLayer({"QUESTION":("ERROR: Unkown direction (" + (("" + b0.value) + ")")),}, b8, false, false, "/", null); +runtime.stopAll(); +retire(); yield; +} +} +} +} +if (compareGreaterThan(b6.value, b9.value.length)) { +b6.value = 1; +} +if (compareLessThan(b6.value, 0)) { +b6.value = b9.value.length; +} +if (compareGreaterThan(b3.value, b10.value)) { +b3.value = 1; +} +if (compareLessThan(b3.value, 0)) { +b3.value = b10.value; +} +return ""; +}; }) + +// Sprite1 Wascii to number %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-costumes-list"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-result-"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +const b3 = stage.variables["o4+OyKx[M=quu6p{=kRl-ascii-list"]; +return function funXYZ_ascii_to_number_ (p0) { +if (listContains(b0, p0)) { +runtime.ext_scratch3_looks._setCostume(target, p0); +if (((target.currentCostume + 1) > 26)) { +b1.value = ((target.currentCostume + 1) + 38); +} else { +b1.value = ((target.currentCostume + 1) + 96); +} +} else { +b2.value = 0; +for (var a0 = b3.value.length; a0 > 0; a0--) { +b2.value = (b2.value + 1); +if (compareEqual((b3.value[b2.value - 1] ?? ""), p0)) { +b1.value = (b2.value - 1); +return ""; +} +} +b1.value = -1; +} +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "aF", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + "0"),}, b0, false, false, "+", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "aH", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 Zascii to number but it lies %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-costumes-list"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-result-"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +const b3 = stage.variables["o4+OyKx[M=quu6p{=kRl-ascii2-list"]; +return function* genXYZ_ascii_to_number_but_ (p0) { +if (listContains(b0, p0)) { +runtime.ext_scratch3_looks._setCostume(target, p0); +if (((target.currentCostume + 1) > 26)) { +b1.value = ((target.currentCostume + 1) + 38); +} else { +b1.value = ((target.currentCostume + 1) + 96); +} +} else { +b2.value = 0; +for (var a0 = b3.value.length; a0 > 0; a0--) { +b2.value = ((+b2.value || 0) + 1); +if (compareEqual((b3.value[(b2.value | 0) - 1] ?? ""), p0)) { +b1.value = (b2.value - 1); +return ""; +} +yield; +} +b1.value = 0; +} +return ""; +}; }) + +// Sprite1 Winsert %s %n %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-result-"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +return function funXYZ_insert___ (p0,p1,p2) { +b0.value = ""; +b1.value = 0; +for (var a0 = ((+p1 || 0) - 1); a0 >= 0.5; a0--) { +b1.value = (b1.value + 1); +b0.value = (("" + b0.value) + ((("" + p0))[(b1.value | 0) - 1] || "")); +} +b0.value = (("" + b0.value) + ("" + p2)); +b1.value = (b1.value + 1); +for (var a1 = (("" + p0).length - b1.value); a1 > 0; a1--) { +b1.value = (b1.value + 1); +b0.value = (("" + b0.value) + ((("" + p0))[(b1.value | 0) - 1] || "")); +} +return ""; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOKAY %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OKAY_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "aB", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + "0"),}, b0, false, false, "*", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "aD", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-broadcast-self-restart-delay.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-broadcast-self-restart-delay.sb3.tw-snapshot new file mode 100644 index 00000000000..4dba7109918 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-broadcast-self-restart-delay.sb3.tw-snapshot @@ -0,0 +1,61 @@ +// TW Snapshot +// Input SHA-256: a018442bac20400dc82b159894be4f188118b41c2f85528416cdbe2eb221b01f + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +const b1 = stage.variables["XpJYYJ:ZH%1jU!x!l(ZP"]; +return function* genXYZ () { +b0.value = 0; +b1.value = 0; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +while (true) { +b1.value = 0; +yield; +} +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +const b1 = stage.variables["XpJYYJ:ZH%1jU!x!l(ZP"]; +return function* genXYZ () { +if (compareGreaterThan(b0.value, 3)) { +if (compareLessThan(b1.value, b0.value)) { +yield* thread.procedures["ZOK %s"](""); +} else { +yield* thread.procedures["ZFAIL %s"](""); +} +} else { +target.setCostume(target.currentCostume + 1); +b0.value = ((+b0.value || 0) + 1); +b1.value = ((+b1.value || 0) + 1); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +} +retire(); return; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "e", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "c", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "g", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "i", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "d", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "k", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-cannot-forceQueue-after-broadcast.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-cannot-forceQueue-after-broadcast.sb3.tw-snapshot new file mode 100644 index 00000000000..61b6860cd27 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-cannot-forceQueue-after-broadcast.sb3.tw-snapshot @@ -0,0 +1,37 @@ +// TW Snapshot +// Input SHA-256: a9d53758e603b449818a648433944c2775495122dab210fdaca971ab4f121a27 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "b", null); +b1.value = 0; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1" }); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +const b1 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +b0.value = ((+b0.value || 0) + 1); +if ((b0.value === 1)) { +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1" }); +thread.timer = timer(); +var a0 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a0) { +yield; +} +thread.timer = null; +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b1, false, false, "l", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b1, false, false, "e", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b1, false, false, "m", null); +} +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-change-size-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-change-size-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..d93fb2bafa3 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-change-size-NaN.sb3.tw-snapshot @@ -0,0 +1,18 @@ +// TW Snapshot +// Input SHA-256: 794320c6ad6c499d6c1e160d8cd1df690fbf045e158faef0df130a0e07560e2b + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "d", null); +target.setSize(100); +target.setSize(target.size + ((0 / 0) || 0)); +if ((Math.round(target.size) === 100)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "j", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-costume-name-infinity-nan.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-costume-name-infinity-nan.sb3.tw-snapshot new file mode 100644 index 00000000000..6c1aee826ce --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-costume-name-infinity-nan.sb3.tw-snapshot @@ -0,0 +1,35 @@ +// TW Snapshot +// Input SHA-256: dad2d51129eae742bdde75772afed267945ce57ccbc8890e504519ff6fd55318 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +runtime.ext_scratch3_looks._setCostume(target, "initial"); +yield* executeInCompatibilityLayer({"MESSAGE":"plan 6",}, b0, false, false, "m", null); +runtime.ext_scratch3_looks._setCostume(target, (1 / 0)); +if ((target.getCostumes()[target.currentCostume].name.toLowerCase() === "good".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass infinity costume name",}, b0, false, false, "x", null); +} +if (((target.currentCostume + 1) === 1)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass infinity costume number",}, b0, false, false, "z", null); +} +runtime.ext_scratch3_looks._setCostume(target, "initial"); +runtime.ext_scratch3_looks._setCostume(target, (1 / -0)); +if ((target.getCostumes()[target.currentCostume].name.toLowerCase() === "good".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -infinity costume name",}, b0, false, false, "E", null); +} +if (((target.currentCostume + 1) === 1)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -infinity costume number",}, b0, false, false, "G", null); +} +runtime.ext_scratch3_looks._setCostume(target, "initial"); +runtime.ext_scratch3_looks._setCostume(target, (0 / 0)); +if ((target.getCostumes()[target.currentCostume].name.toLowerCase() === "good".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass nan costume name",}, b0, false, false, "L", null); +} +if (((target.currentCostume + 1) === 1)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass nan costume number",}, b0, false, false, "O", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "N", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-for-each-in.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-for-each-in.sb3.tw-snapshot new file mode 100644 index 00000000000..ce167385193 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-for-each-in.sb3.tw-snapshot @@ -0,0 +1,134 @@ +// TW Snapshot +// Input SHA-256: 4a00d758e882b2fe0b57020459268c0db38afb7aee290e57f045a5dab2ece743 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["om$AKtHax/H0kJUzYbbi"]; +const b1 = stage.variables["7Oj/v$#js7a33uH`xGl;"]; +return function* genXYZ () { +b0.value = "no change"; +b1.value = 0; +var a0 = 0; while (a0 < 10) { a0++; b0.value = a0; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 10),"i = 10 (each 10)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 10),"dummy = 10 (each 10)"); +b0.value = "no change"; +b1.value = 0; +var a1 = 0; while (a1 < 1) { a1++; b0.value = a1; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 1),"i = 1 (each 1)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 1),"dummy = 1 (each 1)"); +b0.value = "no change"; +b1.value = 0; +var a2 = 0; while (a2 < 0) { a2++; b0.value = a2; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"]((("" + b0.value).toLowerCase() === "no change".toLowerCase()),"i = no change (each 0)"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(b1.value, 0),"dummy = 0 (each 0)"); +b0.value = "no change"; +b1.value = 0; +var a3 = 0; while (a3 < -5) { a3++; b0.value = a3; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"]((("" + b0.value).toLowerCase() === "no change".toLowerCase()),"i = no change (each -5)"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(b1.value, 0),"dummy = 0 (each -5)"); +b0.value = "no change"; +b1.value = 0; +var a4 = 0; while (a4 < 0) { a4++; b0.value = a4; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"]((("" + b0.value).toLowerCase() === "no change".toLowerCase()),"i = no change (each aaaaaa)"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(b1.value, 0),"dummy = 0 (each aaaaaa)"); +b0.value = "no change"; +b1.value = 0; +var a5 = 0; while (a5 < 5.9) { a5++; b0.value = a5; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 6),"i = 6 (each 5.9)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 6),"dummy = 6 (each 5.9)"); +b0.value = "no change"; +b1.value = 0; +var a6 = 0; while (a6 < 5.1) { a6++; b0.value = a6; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 6),"i = 6 (each 5.1)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 6),"dummy = 6 (each 5.1)"); +b0.value = "no change"; +b1.value = 0; +var a7 = 0; while (a7 < -0.1) { a7++; b0.value = a7; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"]((("" + b0.value).toLowerCase() === "no change".toLowerCase()),"i = no change (each -0.1)"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(b1.value, 0),"dummy = 0 (each -0.1)"); +b0.value = "no change"; +b1.value = 0; +var a8 = 0; while (a8 < 0.1) { a8++; b0.value = a8; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 1),"i = 1 (each 0.1)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 1),"dummy = 1 (each 0.1)"); +b0.value = "no change"; +var a9 = 0; while (a9 < 5) { a9++; b0.value = a9; +b0.value = 8; +b1.value = 9; +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 8),"i = 8 (each 5 w/set)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 9),"dummy = 9 (each 5 w/set)"); +b0.value = "no change"; +b1.value = 1; +var a10 = 0; while (a10 < 5) { a10++; b0.value = a10; +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(b0.value, b1.value),"i = dummy (each 5 w/set+dummy check)"); +b1.value = ((+b1.value || 0) + 1); +b0.value = 9999; +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 9999),"i = 9999 (after each 5 w/set+dummy check)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 6),"dummy = 6 (after each 5 w/set+dummy check)"); +yield* thread.procedures["ZOK %s"]("ok"); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "O", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "Q", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "S", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "U", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-glide-negative-time.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-glide-negative-time.sb3.tw-snapshot new file mode 100644 index 00000000000..24acc11d952 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-glide-negative-time.sb3.tw-snapshot @@ -0,0 +1,43 @@ +// TW Snapshot +// Input SHA-256: 02a87b5a1b3b7a692c904422b1b22ea0fb6a7240ab3ca998a921674f4152b04e + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +thread.timer = timer(); +var a0 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a0) { +yield; +} +thread.timer = null; +thread.timer = timer(); +var a1 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a1) { +yield; +} +thread.timer = null; +if ((limitPrecision(target.x) === 100)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "m", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "n", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", null); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = runtime.getOpcodeFunction("motion_glidesecstoxy"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "d", null); +target.setXY(0, 0); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +yield* executeInCompatibilityLayer({"SECS":-1,"X":100,"Y":0,}, b1, false, false, "h", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-glide-xy-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-glide-xy-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..349094412fa --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-glide-xy-NaN.sb3.tw-snapshot @@ -0,0 +1,19 @@ +// TW Snapshot +// Input SHA-256: 052a07292a98c770d3cdf1df2670a8eb2c4e488041187e45e7ffb6e8944013b6 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = runtime.getOpcodeFunction("motion_glidesecstoxy"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "d", null); +target.setXY(-100, -100); +yield* executeInCompatibilityLayer({"SECS":0,"X":(0 / 0),"Y":100,}, b1, false, false, "b", null); +if ((limitPrecision(target.x) === 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "j", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-mathop-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-mathop-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..59e376d2266 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-mathop-NaN.sb3.tw-snapshot @@ -0,0 +1,37 @@ +// TW Snapshot +// Input SHA-256: 082b59a5b772f80c84bc6a846d9ea5023863d8f90c5b85e599b53fed7a9d6a46 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 8",}, b0, false, false, "j", null); +b1.value = (1 / 0); +if (((10 + (Math.sqrt(-1) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "R", null); +} +if (((10 + ((Math.round(Math.sin((Math.PI * (+b1.value || 0)) / 180) * 1e10) / 1e10) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "B", null); +} +if (((10 + ((Math.round(Math.cos((Math.PI * (+b1.value || 0)) / 180) * 1e10) / 1e10) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "D", null); +} +if (((10 + (tan((+b1.value || 0)) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "F", null); +} +if (((10 + (((Math.asin(2) * 180) / Math.PI) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "H", null); +} +if (((10 + (((Math.acos(2) * 180) / Math.PI) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "J", null); +} +if (((10 + (Math.log(-1) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "L", null); +} +if (((10 + ((Math.log(-1) / Math.LN10) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "O", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "N", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-negative-zero.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-negative-zero.sb3.tw-snapshot new file mode 100644 index 00000000000..8fdbb26b8f4 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-negative-zero.sb3.tw-snapshot @@ -0,0 +1,44 @@ +// TW Snapshot +// Input SHA-256: 392c8fcd9ce3e05cfb9ec1f39713073fca6c3a702fbd49697e2e496376e6b4f6 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"]((((1 / 0) || 0) === Infinity),"1/0"); +yield* thread.procedures["ZassertTrue %b %s"]((((1 / -0) || 0) === -Infinity),"1/-0"); +yield* thread.procedures["ZOK %s"]("ok"); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "i", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "k", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "m", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "o", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-operators-output-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-operators-output-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..042ff267e16 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-operators-output-NaN.sb3.tw-snapshot @@ -0,0 +1,27 @@ +// TW Snapshot +// Input SHA-256: 289d73b9be2b60f501e57768410029798d2dec7d971e5935e5f19fb2a9988169 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["k|@-`:^^Mo+E}$({|2/P"]; +const b2 = stage.variables["t2m05.oW;5f0=GL30@pV"]; +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 4",}, b0, false, false, "g", null); +b1.value = (1 / 0); +b2.value = (-1 / 0); +if ((("" + (b1.value + b2.value)).toLowerCase() === "NaN".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 1",}, b0, false, false, "m", null); +} +if ((("" + ((+b1.value || 0) - (+b1.value || 0))).toLowerCase() === "NaN".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 1",}, b0, false, false, "n", null); +} +if ((("" + ((+b1.value || 0) * 0)).toLowerCase() === "NaN".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 1",}, b0, false, false, "o", null); +} +if ((("" + (0 / 0)).toLowerCase() === "NaN".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 1",}, b0, false, false, "q", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "p", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-operators.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-operators.sb3.tw-snapshot new file mode 100644 index 00000000000..410134f99b6 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-operators.sb3.tw-snapshot @@ -0,0 +1,165 @@ +// TW Snapshot +// Input SHA-256: 1142c0dcd16b015bae6b8df3e70e1e4572decc653e0c5f4af57a9a7313e8d458 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["Zassert %b %s"]((((0.1 + 0.2) || 0) === 0.30000000000000004),"adding must work w/ floating point errors"); +yield* thread.procedures["Zassert %b %s"]((((0.2 - -0.1) || 0) === 0.30000000000000004),"subtraction must work w/ floating point errors"); +yield* thread.procedures["Zassert %b %s"]((((0 - 5) || 0) === -5),"substraction should invert with empty right side"); +yield* thread.procedures["Zassert %b %s"]((((222 * 2) || 0) === 444),"multiplication must work"); +yield* thread.procedures["Zassert %b %s"]((((222 / 2) || 0) === 111),"division must work"); +yield* thread.procedures["Zassert %b %s"]((((100 / 0) || 0) === Infinity),"100/0 must equal Infinity"); +for (var a0 = 5; a0 > 0; a0--) { +yield* thread.procedures["Zassert %b %s"](!(randomInt(1, 10) < 1),"pick random should have a lower bound (inclusive)"); +yield* thread.procedures["Zassert %b %s"](!(randomInt(1, 10) > 10),"pick random should have an upper bound (inclusive)"); +yield* thread.procedures["Zassert %b %s"]((1 === 1),"pick random of range 0 should return either bound"); +yield* thread.procedures["Zassert %b %s"](!compareEqual(mod((randomFloat(1, 2) || 0), 1), 0),"pick random w/ decimal bounds should return decimals"); +yield* thread.procedures["Zassert %b %s"](!compareEqual(mod((randomFloat(1, 2) || 0), 1), 0),"pick random w/ decimal (.0) bounds should return decimals"); +yield* thread.procedures["Zassert %b %s"](!compareEqual(mod((randomFloat(1, 2) || 0), 1), 0),"pick random w/ decimal (.0) bounds should return decimals"); +yield* thread.procedures["Zassert %b %s"](!compareEqual(mod((randomFloat(1.1, 2) || 0), 1), 0),"pick random w/ decimal bounds should return decimals"); +yield* thread.procedures["Zassert %b %s"](!compareEqual(mod((randomFloat(1, 2.1) || 0), 1), 0),"pick random w/ decimal bounds should return decimals"); +yield; +} +yield* thread.procedures["Zassert %b %s"]((1 > 0),"1 must be greater than 0"); +yield* thread.procedures["Zassert %b %s"](!(0 > 1),"0 must not be greater than 1"); +yield* thread.procedures["Zassert %b %s"]((0 < 1),"0 must be less than 1"); +yield* thread.procedures["Zassert %b %s"](!(1 < 0),"1 must not be greater than 1"); +yield* thread.procedures["Zassert %b %s"]((1 === 1),"1 must equal 1"); +yield* thread.procedures["Zassert %b %s"](!("hello".toLowerCase() === "world".toLowerCase()),"hello must not equal world"); +yield* thread.procedures["Zassert %b %s"](("hello".toLowerCase() === "hello".toLowerCase()),"hello must equal hello"); +yield* thread.procedures["Zassert %b %s"](("".toLowerCase() === "".toLowerCase()),"empty must equal empty"); +yield* thread.procedures["Zassert %b %s"](!(" ".toLowerCase() === "".toLowerCase()),"spaces must not be ignored in equal"); +yield* thread.procedures["Zassert %b %s"](("👌".toLowerCase() === "👌".toLowerCase()),"equal should support emoji"); +yield* thread.procedures["Zassert %b %s"](!(0.30000000000000004 === 0.3),"number comparison must be precise"); +yield* thread.procedures["Zassert %b %s"]((0.1 === 0.1),"number comparison should disregard following zeros"); +yield* thread.procedures["Zassert %b %s"]((0.1 === 0.1),"number comparison should disregard leading zeros"); +yield* thread.procedures["Zassert %b %s"](compareEqual((0 / 0), (0 / 0)),"number NaN must equal number NaN"); +yield* thread.procedures["Zassert %b %s"](!false,"empty negate must be true"); +yield* thread.procedures["Zassert %b %s"](!!!false,"negate true must be false"); +yield* thread.procedures["Zassert %b %s"](!!!!!!!false,"negates must be stackable to the moon"); +yield* thread.procedures["Zassert %b %s"]((("apple " + "banana").toLowerCase() === "apple banana".toLowerCase()),"join must join strings"); +yield* thread.procedures["Zassert %b %s"](((("apple")[1 - 1] || "").toLowerCase() === "a".toLowerCase()),"letter 1 of apple must be apple"); +yield* thread.procedures["Zassert %b %s"](((("apple")[0 - 1] || "").toLowerCase() === "".toLowerCase()),"letter 0 of apple must be empty"); +yield* thread.procedures["Zassert %b %s"](((("apple")[((0 - 1) | 0) - 1] || "").toLowerCase() === "".toLowerCase()),"letter -1 of apple must be empty"); +yield* thread.procedures["Zassert %b %s"](((("apple")[9999 - 1] || "").toLowerCase() === "".toLowerCase()),"letter 9999 of apple must be empty"); +yield* thread.procedures["Zassert %b %s"](("apple".length === 5),"length of apple must be 5"); +yield* thread.procedures["Zassert %b %s"](("".length === 0),"length of empty string must be 0"); +yield* thread.procedures["Zassert %b %s"](("apple".toLowerCase().indexOf("a".toLowerCase()) !== -1),"apple must contain a"); +yield* thread.procedures["Zassert %b %s"](!("apple".toLowerCase().indexOf("b".toLowerCase()) !== -1),"apple must not contain b"); +yield* thread.procedures["Zassert %b %s"](!("👌".toLowerCase().indexOf("👏".toLowerCase()) !== -1),"👌 must not contain 👏"); +yield* thread.procedures["Zassert %b %s"](("👌👌".toLowerCase().indexOf("👌".toLowerCase()) !== -1),"👌👌 must contain 👌"); +yield* thread.procedures["Zassert %b %s"](((mod(3, 4) || 0) === 3),"3 mod 4 must be 3"); +yield* thread.procedures["Zassert %b %s"](((mod(3, -4) || 0) === -1),"3 mod -4 must be -1"); +yield* thread.procedures["Zassert %b %s"](((mod(-3, 4) || 0) === 1),"-3 mod 4 must be 1"); +yield* thread.procedures["Zassert %b %s"](compareEqual(mod(3, 3), 0),"a number mod itself must be 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual(mod(-3, 3), 0),"a number mod it's positive inverse must be 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual(mod(3, -3), 0),"a number mod it's negative inverse must be 0"); +yield* thread.procedures["Zassert %b %s"]((("" + mod(3, 0)).toLowerCase() === "NaN".toLowerCase()),"any number mod 0 must be NaN"); +yield* thread.procedures["Zassert %b %s"](((mod(1.5, 1) || 0) === 0.5),"mod 1 must result in only decimal part"); +yield* thread.procedures["Zassert %b %s"](((mod(3.3, 1) || 0) === 0.2999999999999998),"3.3 mod 1 must have floating point errors"); +yield* thread.procedures["Zassert %b %s"]((Math.round(0) === 0),"rounding 0 must be 0"); +yield* thread.procedures["Zassert %b %s"]((Math.round(0.1) === 0),"rounding .1 must be 0"); +yield* thread.procedures["Zassert %b %s"]((Math.round(0.9) === 1),"rounding .9 must be 1"); +yield* thread.procedures["Zassert %b %s"]((Math.round(-0.5) === 0),"rounding -.5 must be 0"); +yield* thread.procedures["Zassert %b %s"]((Math.round(-0.1) === 0),"roudning -.1 must be 0"); +yield* thread.procedures["Zassert %b %s"]((Math.round(-0.51) === -1),"roudning -.51 must be -1"); +yield* thread.procedures["Zassert %b %s"](((+!false) === 1),"true must equal 1"); +yield* thread.procedures["Zassert %b %s"](((+!!false) === 0),"false must equal 0"); +yield* thread.procedures["Zassert %b %s"]((((9007199254740992 + 1) || 0) === 9007199254740992),"math should start breaking after 9007199254740991"); +yield* thread.procedures["Zassert %b %s"]((Math.abs(5) === 5),"absolute value of a position number should be itself"); +yield* thread.procedures["Zassert %b %s"]((Math.abs(-5) === 5),"absolute value of a negative number should be its inverse"); +yield* thread.procedures["Zassert %b %s"]((Math.floor(5.9) === 5),"floor of a number should round it down"); +yield* thread.procedures["Zassert %b %s"]((Math.ceil(5.9) === 6),"ceiling of a number should round it up"); +yield* thread.procedures["Zassert %b %s"](((Math.sqrt(4) || 0) === 2),"sqrt of 4 must be 2"); +yield* thread.procedures["Zassert %b %s"](((Math.sqrt(2) || 0) === 1.4142135623730951),"sqrt of 2 must be 1.4142135623730951"); +yield* thread.procedures["Zassert %b %s"]((Math.round((((Math.asin(0.5) * 180) / Math.PI) || 0)) === 30),"asin of .5 must be roughly 30"); +yield* thread.procedures["Zassert %b %s"](compareEqual(Math.log(1), 0),"ln 1 must be 0"); +yield* thread.procedures["Zassert %b %s"](((Math.log(2) || 0) === 0.6931471805599453),"ln 2 must be 0.69314..."); +yield* thread.procedures["Zassert %b %s"](((Math.log(2.718281828459045) || 0) === 1),"ln e must be 1"); +yield* thread.procedures["Zassert %b %s"](((Math.log(Math.exp(2)) || 0) === 2),"ln e^2 must be 2"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.log(1) / Math.LN10), 0),"log 1 must be 0"); +yield* thread.procedures["Zassert %b %s"]((((Math.log(2) / Math.LN10) || 0) === 0.30102999566398114),"log 2 must be 0.3010..."); +yield* thread.procedures["Zassert %b %s"]((((Math.log(10) / Math.LN10) || 0) === 1),"log 10 must be 1"); +yield* thread.procedures["Zassert %b %s"]((((Math.log(100) / Math.LN10) || 0) === 2),"log 100 must be 2"); +yield* thread.procedures["Zassert %b %s"]((Math.exp(1) === 2.718281828459045),"e ^ 1 must be 2.718281828459045"); +yield* thread.procedures["Zassert %b %s"]((Math.exp(0) === 1),"e ^ 0 must be 1"); +yield* thread.procedures["Zassert %b %s"](((10 ** 1) === 10),"10 ^ 1 must be 10"); +yield* thread.procedures["Zassert %b %s"](((10 ** 0) === 1),"10 ^ 0 must be 1"); +yield* thread.procedures["Zassert %b %s"](((10 ** 2) === 100),"10 ^ 2 must be 100"); +yield* thread.procedures["Zassert %b %s"](((+(0 === 50)) === (+(0 === 50))),"real false = real false"); +yield* thread.procedures["Zassert %b %s"](((+("".toLowerCase() === "".toLowerCase())) === (+("".toLowerCase() === "".toLowerCase()))),"real true = real true"); +yield* thread.procedures["Zassert %b %s"](("true".toLowerCase() === ("" + ("".toLowerCase() === "".toLowerCase())).toLowerCase()),"string true = real true"); +yield* thread.procedures["Zassert %b %s"](("false".toLowerCase() === ("" + (0 === 50)).toLowerCase()),"string false = real false"); +yield* thread.procedures["Zassert %b %s"]((("" + ("".toLowerCase() === "".toLowerCase())).toLowerCase() === "true".toLowerCase()),"real true = string true"); +yield* thread.procedures["Zassert %b %s"]((("" + (0 === 50)).toLowerCase() === "false".toLowerCase()),"real false = string false"); +yield* thread.procedures["Zassert %b %s"](((+(0 === 1)) === 0),"real false = string 0"); +yield* thread.procedures["Zassert %b %s"](((+(0 === 0)) === 1),"real true = string 1"); +yield* thread.procedures["Zassert %b %s"](compareEqual((0 === 1), (0 + 0)),"real false = number 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual((0 === 0), (1 + 0)),"real true = number 1"); +yield* thread.procedures["Zassert %b %s"](((((+("0x" + "12f3") || 0) + 0) || 0) === 4851),"positive hex"); +yield* thread.procedures["Zassert %b %s"](((((+("0o" + "127") || 0) + 0) || 0) === 87),"positive octal"); +yield* thread.procedures["Zassert %b %s"](((((+("0b" + "1010101") || 0) + 0) || 0) === 85),"positive binary"); +yield* thread.procedures["Zassert %b %s"](compareEqual(((+("-0x" + "123") || 0) + 0), 0),"negative hex is 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual(((+("-0o" + "123") || 0) + 0), 0),"negative octal is 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual(((+("-0b" + "10101") || 0) + 0), 0),"negative binary is 0"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * 57.7) / 180) * 1e10) / 1e10) || 0) === 0.8452618332),"sin 57.7"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.sin((Math.PI * 0) / 180) * 1e10) / 1e10), 0),"sin 0"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * 90) / 180) * 1e10) / 1e10) || 0) === 1),"sin 90"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.sin((Math.PI * 180) / 180) * 1e10) / 1e10), 0),"sin 180"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * 270) / 180) * 1e10) / 1e10) || 0) === -1),"sin 270"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.sin((Math.PI * 360) / 180) * 1e10) / 1e10), 0),"sin 360"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * 450) / 180) * 1e10) / 1e10) || 0) === 1),"sin 450"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * -90) / 180) * 1e10) / 1e10) || 0) === -1),"sin -90"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.sin((Math.PI * -180) / 180) * 1e10) / 1e10), 0),"sin -180"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * -270) / 180) * 1e10) / 1e10) || 0) === 1),"sin -270"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.sin((Math.PI * -360) / 180) * 1e10) / 1e10), 0),"sin -360"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * -450) / 180) * 1e10) / 1e10) || 0) === -1),"sin -450"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * 57.7) / 180) * 1e10) / 1e10) || 0) === 0.5343523494),"cos 57.7"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * 0) / 180) * 1e10) / 1e10) || 0) === 1),"cos 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * 90) / 180) * 1e10) / 1e10), 0),"cos 90"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * 180) / 180) * 1e10) / 1e10) || 0) === -1),"cos 180"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * 270) / 180) * 1e10) / 1e10), 0),"cos 270"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * 360) / 180) * 1e10) / 1e10) || 0) === 1),"cos 360"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * 450) / 180) * 1e10) / 1e10), 0),"cos 450"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * -90) / 180) * 1e10) / 1e10), 0),"cos -90"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * -180) / 180) * 1e10) / 1e10) || 0) === -1),"cos -180"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * -270) / 180) * 1e10) / 1e10), 0),"cos -270"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * -360) / 180) * 1e10) / 1e10) || 0) === 1),"cos -360"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * -450) / 180) * 1e10) / 1e10), 0),"cos -450"); +yield* thread.procedures["ZOKAY"](); +retire(); return; +}; }) + +// Sprite1 Zassert %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assert__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOKAY +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OKAY () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "cL", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + "0"),}, b0, false, false, "aX", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "cM", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "a!", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + "0"),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "a%", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-preserve-order-after-stop-other-scripts.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-preserve-order-after-stop-other-scripts.sb3.tw-snapshot new file mode 100644 index 00000000000..d5352099960 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-preserve-order-after-stop-other-scripts.sb3.tw-snapshot @@ -0,0 +1,81 @@ +// TW Snapshot +// Input SHA-256: 33ae042ed2e2affa758cf695de33f44b075e96d01ccb919972d262517492f6fc + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["C7VGwqE9rvJgpw(oV^?E"]; +return function* genXYZ () { +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "3" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "2" }); +runtime.stopForTarget(target, thread); +b0.value = []; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "2" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "3" }); +thread.timer = timer(); +var a0 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a0) { +yield; +} +thread.timer = null; +if (((+listContents(b0) || 0) === 312)) { +yield* thread.procedures["ZOK %s"](""); +} else { +yield* thread.procedures["ZFAIL %s"](""); +} +retire(); return; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "d", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "f", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "h", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "c", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "j", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["C7VGwqE9rvJgpw(oV^?E"]; +return function* genXYZ () { +b0.value.push(1); +b0._monitorUpToDate = false; +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["C7VGwqE9rvJgpw(oV^?E"]; +return function* genXYZ () { +b0.value.push(2); +b0._monitorUpToDate = false; +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["C7VGwqE9rvJgpw(oV^?E"]; +return function* genXYZ () { +b0.value.push(3); +b0._monitorUpToDate = false; +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-procedure-definition-order.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-procedure-definition-order.sb3.tw-snapshot new file mode 100644 index 00000000000..63d4e6deecd --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-procedure-definition-order.sb3.tw-snapshot @@ -0,0 +1,28 @@ +// TW Snapshot +// Input SHA-256: 2979239837a20f2d91405b400ec98101ec8262f2e0b89b0f0204591c9dd9c25d + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["ZA"](); +retire(); return; +}; }) + +// Sprite1 ZA +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_A () { +yield* thread.procedures["ZOK %s"](""); +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "c", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "e", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-run-blocks-after-self-broadcast.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-run-blocks-after-self-broadcast.sb3.tw-snapshot new file mode 100644 index 00000000000..24dc9e4c3d5 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-run-blocks-after-self-broadcast.sb3.tw-snapshot @@ -0,0 +1,56 @@ +// TW Snapshot +// Input SHA-256: 9902bbdd6b9a5d5c25b5382a533e1b3a72ea1f5ca68709abf08a9e6af339f2c7 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables[")Vp94b3HO|$4At]V7XiJ"]; +const b1 = stage.variables["`NuUx`@:w=|8`D7S4l-t"]; +return function* genXYZ () { +b0.value = 0; +b1.value = 0; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables[")Vp94b3HO|$4At]V7XiJ"]; +const b1 = stage.variables["`NuUx`@:w=|8`D7S4l-t"]; +return function* genXYZ () { +if (compareEqual(b0.value, 0)) { +b0.value = 1; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +b1.value = 1; +} else { +if (((+b1.value || 0) === 1)) { +yield* thread.procedures["ZOK %s"](""); +} else { +yield* thread.procedures["ZFAIL %s"](""); +} +} +retire(); return; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "i", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "d", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "k", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "e", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "c", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "g", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-scripts-run-after-stop-all.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-scripts-run-after-stop-all.sb3.tw-snapshot new file mode 100644 index 00000000000..8a3a1131c49 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-scripts-run-after-stop-all.sb3.tw-snapshot @@ -0,0 +1,93 @@ +// TW Snapshot +// Input SHA-256: 53f9471a2e476b366db519bae1d739833c0210dd92ca501a29a3dfce9a1f960d + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "3loop" }); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["5*)/o6gQzEw)31Ah!j:j"]; +const b1 = stage.variables["sYUvu8`..xuGcWX3!B1k"]; +return function* genXYZ () { +while (!compareGreaterThan(b0.value, 2)) { +b0.value = ((+b0.value || 0) + 1); +yield; +} +if (((+b1.value || 0) === 1)) { +yield* thread.procedures["ZOK %s"](""); +} else { +if (compareEqual(b1.value, 0)) { +yield* thread.procedures["ZFAIL %s"]("variable 1 haven't been incremented"); +} else { +yield* thread.procedures["ZFAIL %s"]("variable 1 got incremented multiple times"); +} +} +retire(); return; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "f", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "d", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "j", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "e", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["sYUvu8`..xuGcWX3!B1k"]; +const b1 = stage.variables["5*)/o6gQzEw)31Ah!j:j"]; +return function* genXYZ () { +b0.value = 0; +b1.value = 0; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "2" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "3" }); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +runtime.stopAll(); +retire(); return; +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1loop" }); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["sYUvu8`..xuGcWX3!B1k"]; +return function* genXYZ () { +while (true) { +b0.value = ((+b0.value || 0) + 1); +yield; +} +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-stop-other-scripts-in-sprite.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-stop-other-scripts-in-sprite.sb3.tw-snapshot new file mode 100644 index 00000000000..e447f4aa379 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-stop-other-scripts-in-sprite.sb3.tw-snapshot @@ -0,0 +1,36 @@ +// TW Snapshot +// Input SHA-256: 1d077dfdf08990f391b64e59cc3b31530abe3b2aef12e54678743a1f74f99ae5 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "b", null); +b1.value = 0; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +runtime.stopForTarget(target, thread); +thread.timer = timer(); +var a0 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a0) { +yield; +} +thread.timer = null; +if (compareEqual(b1.value, 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "k", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "m", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "j", null); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +return function* genXYZ () { +b0.value = ((+b0.value || 0) + 1); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-string-functions.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-string-functions.sb3.tw-snapshot new file mode 100644 index 00000000000..275faa52ce0 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-string-functions.sb3.tw-snapshot @@ -0,0 +1,276 @@ +// TW Snapshot +// Input SHA-256: 0d7c7d4a267a29ff249f9314e87a7a7170870dc48175ffdba5a12fa48e8ba0a2 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["Ztest endsWith"](); +yield* thread.procedures["Ztest startsWith"](); +yield* thread.procedures["Ztest includes"](); +yield* thread.procedures["Ztest indexOf"](); +yield* thread.procedures["Ztest replace"](); +yield* thread.procedures["ZOKAY %s"]((("" + runtime.ioDevices.clock.projectTimer()) + " seconds")); +retire(); return; +}; }) + +// Sprite1 Ztest endsWith +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ_test_endsWith () { +thread.procedures["W%s .endsWith( %s )"](12333,333); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must end with 333"); +thread.procedures["W%s .endsWith( %s )"](12333,33); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must end with 33"); +thread.procedures["W%s .endsWith( %s )"](12333,""); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must end with empty string"); +thread.procedures["W%s .endsWith( %s )"](12333,4); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "false".toLowerCase()),"12333 must not end with 4"); +thread.procedures["W%s .endsWith( %s )"](12333,123334); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "false".toLowerCase()),"12333 must not end with 123334"); +thread.procedures["W%s .endsWith( %s )"](12333,12333); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must end with itself"); +thread.procedures["W%s .includes( %s )"]("abc",""); +return ""; +}; }) + +// Sprite1 Ztest startsWith +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ_test_startsWith () { +thread.procedures["W%s .startsWith( %s )"](12333,12333); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with 12333"); +thread.procedures["W%s .startsWith( %s )"](12333,1233); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with 1233"); +thread.procedures["W%s .startsWith( %s )"](12333,123); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with 123"); +thread.procedures["W%s .startsWith( %s )"](12333,12); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with 12"); +thread.procedures["W%s .startsWith( %s )"](12333,1); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with 1"); +thread.procedures["W%s .startsWith( %s )"](12333,""); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with empty string"); +thread.procedures["W%s .startsWith( %s )"](12333,33); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "false".toLowerCase()),"12333 must not start with 33"); +return ""; +}; }) + +// Sprite1 Ztest includes +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ_test_includes () { +thread.procedures["W%s .includes( %s )"]("abc",""); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include empty string"); +thread.procedures["W%s .includes( %s )"]("",""); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"empty string must include empty string"); +thread.procedures["W%s .includes( %s )"]("abc","abc"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include abc"); +thread.procedures["W%s .includes( %s )"]("abc","a"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include a"); +thread.procedures["W%s .includes( %s )"]("abc","b"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include b"); +thread.procedures["W%s .includes( %s )"]("abc","c"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include c"); +thread.procedures["W%s .includes( %s )"]("abc","ab"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include ab"); +thread.procedures["W%s .includes( %s )"]("abc","bc"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include bc"); +thread.procedures["W%s .includes( %s )"]("abc","aa"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "false".toLowerCase()),"abc must not include aa"); +return ""; +}; }) + +// Sprite1 Ztest indexOf +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ_test_indexOf () { +thread.procedures["W%s .indexOf( %s )"](123,1); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === 1),"index of 1 in 123 is 1"); +thread.procedures["W%s .indexOf( %s )"](123,2); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === 2),"index of 2 in 123 is 2"); +thread.procedures["W%s .indexOf( %s )"](123,3); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === 3),"index of 3 in 123 is 3"); +thread.procedures["W%s .indexOf( %s )"](123,"aaaa"); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === -1),"index of aaaa in 123 is -1"); +return ""; +}; }) + +// Sprite1 Ztest lastIndexOf +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function funXYZ_test_lastIndexOf () { +return ""; +}; }) + +// Sprite1 Ztest replace +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ_test_replace () { +thread.procedures["W%s .replace( %s with %s )"](123456,345,"a"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "12a6".toLowerCase()),"replace expected 12a6"); +thread.procedures["W%s .replace( %s with %s )"](123,123,456); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === 456),"replace expected 456"); +thread.procedures["W%s .replace( %s with %s )"](123,1234,456); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === 123),"replace expected 123"); +return ""; +}; }) + +// Sprite1 Ztest split +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function funXYZ_test_split () { +return ""; +}; }) + +// Sprite1 ZOKAY %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OKAY_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "aq", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + "0"),}, b0, false, false, "C", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "as", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 W%s .endsWith( %s ) +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:bufferl-list"]; +const b1 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:iterator-"]; +const b2 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function funXYZ___endsWith____ (p0,p1) { +b0.value = []; +b1.value = ("" + p0).length; +for (var a0 = ("" + p1).length; a0 > 0; a0--) { +b0.value.unshift(((("" + p0))[(b1.value | 0) - 1] || "")); +b0._monitorUpToDate = false; +b1.value = (b1.value + -1); +} +b2.value = compareEqual(listContents(b0), p1); +return ""; +}; }) + +// Sprite1 Zassert %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assert__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 W%s .includes( %s ) +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +const b1 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:bufferl-list"]; +const b2 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:iterator-"]; +return function funXYZ___includes____ (p0,p1) { +if ((("" + p1).length === 0)) { +b0.value = "true"; +return ""; +} +b1.value = []; +b0.value = "false"; +b2.value = 0; +for (var a0 = ("" + p0).length; a0 > 0; a0--) { +b2.value = (b2.value + 1); +b1.value.push(((("" + p0))[(b2.value | 0) - 1] || "")); +b1._monitorUpToDate = false; +if ((b1.value.length > ("" + p1).length)) { +b1.value.shift(); +b1._monitorUpToDate = false; +} +if (compareEqual(listContents(b1), p1)) { +b0.value = "true"; +return ""; +} +} +return ""; +}; }) + +// Sprite1 W%s .startsWith( %s ) +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:bufferl-list"]; +const b1 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:iterator-"]; +const b2 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function funXYZ___startsWith____ (p0,p1) { +b0.value = []; +b1.value = 0; +for (var a0 = ("" + p1).length; a0 > 0; a0--) { +b1.value = (b1.value + 1); +b0.value.push(((("" + p0))[(b1.value | 0) - 1] || "")); +b0._monitorUpToDate = false; +} +b2.value = compareEqual(listContents(b0), p1); +return ""; +}; }) + +// Sprite1 W%s .indexOf( %s ) +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:bufferl-list"]; +const b1 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +const b2 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:iterator-"]; +return function funXYZ___indexOf____ (p0,p1) { +b0.value = []; +b1.value = -1; +b2.value = 0; +for (var a0 = ("" + p0).length; a0 > 0; a0--) { +b2.value = (b2.value + 1); +b0.value.push(((("" + p0))[(b2.value | 0) - 1] || "")); +b0._monitorUpToDate = false; +if ((b0.value.length > ("" + p1).length)) { +b0.value.shift(); +b0._monitorUpToDate = false; +} +if (compareEqual(listContents(b0), p1)) { +b1.value = (b2.value - (("" + p1).length - 1)); +return ""; +} +} +return ""; +}; }) + +// Sprite1 W%s .replace( %s with %s ) +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:bufferl-list"]; +const b1 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:templ-list"]; +const b2 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +const b3 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:iterator-"]; +return function funXYZ___replace___with___ (p0,p1,p2) { +b0.value = []; +b1.value = []; +b2.value = ""; +b3.value = 0; +for (var a0 = ("" + p0).length; a0 > 0; a0--) { +b3.value = (b3.value + 1); +b0.value.push(((("" + p0))[(b3.value | 0) - 1] || "")); +b0._monitorUpToDate = false; +if ((b0.value.length > ("" + p1).length)) { +b0.value.shift(); +b0._monitorUpToDate = false; +} +b1.value.push(((("" + p0))[(b3.value | 0) - 1] || "")); +b1._monitorUpToDate = false; +if (compareEqual(listContents(b0), p1)) { +for (var a1 = ("" + p1).length; a1 > 0; a1--) { +b1.value.pop(); +b1._monitorUpToDate = false; +} +b2.value = (("" + b2.value) + listContents(b1)); +b2.value = (("" + b2.value) + ("" + p2)); +b1.value = []; +} +} +b2.value = (("" + b2.value) + listContents(b1)); +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "bY", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + "0"),}, b0, false, false, "=", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "b!", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/forkphorus-tangent.sb3.tw-snapshot b/test/snapshot/__snapshots__/forkphorus-tangent.sb3.tw-snapshot new file mode 100644 index 00000000000..b2ccf9ce3a3 --- /dev/null +++ b/test/snapshot/__snapshots__/forkphorus-tangent.sb3.tw-snapshot @@ -0,0 +1,56 @@ +// TW Snapshot +// Input SHA-256: 1446684578b41ff41cf29fbe14696ef717cca636e8d46babd7d9dec6df723a33 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 15",}, b0, false, false, "p", null); +if (compareEqual(tan(0), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 0",}, b0, false, false, "O", null); +} +if (((tan(90) || 0) === Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 90",}, b0, false, false, "G", null); +} +if (compareEqual(tan(180), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 180",}, b0, false, false, "I", null); +} +if (((tan(270) || 0) === -Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 270",}, b0, false, false, "K", null); +} +if (compareEqual(tan(360), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 360",}, b0, false, false, "M", null); +} +if (((tan(450) || 0) === Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 450",}, b0, false, false, "Q", null); +} +if (compareEqual(tan(540), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 540",}, b0, false, false, "S", null); +} +if (((tan(630) || 0) === -Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 630",}, b0, false, false, "U", null); +} +if (compareEqual(tan(720), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 720",}, b0, false, false, "W", null); +} +if (((tan(810) || 0) === Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 810",}, b0, false, false, "Y", null); +} +if (((tan(-90) || 0) === -Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -90",}, b0, false, false, "0", null); +} +if (compareEqual(tan(-180), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -180",}, b0, false, false, "2", null); +} +if (((tan(-270) || 0) === Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -270",}, b0, false, false, "4", null); +} +if (compareEqual(tan(-360), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -360",}, b0, false, false, "6", null); +} +if (((tan(-450) || 0) === -Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -450",}, b0, false, false, "9", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "8", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/tw-loop-custom-reporter.sb3.tw-snapshot b/test/snapshot/__snapshots__/tw-loop-custom-reporter.sb3.tw-snapshot deleted file mode 100644 index a606d8595fd..00000000000 --- a/test/snapshot/__snapshots__/tw-loop-custom-reporter.sb3.tw-snapshot +++ /dev/null @@ -1,27 +0,0 @@ -// TW Snapshot -// Input SHA-256: 360d8b29e0e690dda9e91faed6881057d1f38d98258ed8e11c75bdd30536b560 - -// Sprite1 script -(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); -const b0 = runtime.getOpcodeFunction("looks_say"); -const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; -return function* genXYZ () { -yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, null, null); -b1.value = 0; -for (var a0 = (+thread.procedures["Zblock name"]() || 0); a0 >= 0.5; a0--) { -b1.value = ((+b1.value || 0) + 1); -yield; -} -if (((+b1.value || 0) === 4)) { -yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null, null); -} -yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null, null); -retire(); return; -}; }) - -// Sprite1 block name -(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); -return function funXYZ_block_name () { -return 4; -return ""; -}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-105-contains.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-105-contains.sb3.tw-snapshot new file mode 100644 index 00000000000..ba4fc637e92 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-105-contains.sb3.tw-snapshot @@ -0,0 +1,45 @@ +// TW Snapshot +// Input SHA-256: d641b68a89119171eff5d36de1bd4f59b1649acc5ae55803fb0b797b636f52bb + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"](("apple".toLowerCase().indexOf("aPPle".toLowerCase()) !== -1),"apple contains aPPle"); +yield* thread.procedures["ZassertTrue %b %s"](("APPLE".toLowerCase().indexOf("app".toLowerCase()) !== -1),"APPLE contains app"); +yield* thread.procedures["ZassertTrue %b %s"](("appLe".toLowerCase().indexOf("LE".toLowerCase()) !== -1),"appLe contains LE"); +yield* thread.procedures["ZOK %s"]("ok"); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "j", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "n", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "p", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-112.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-112.sb3.tw-snapshot new file mode 100644 index 00000000000..babf8baf6d1 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-112.sb3.tw-snapshot @@ -0,0 +1,45 @@ +// TW Snapshot +// Input SHA-256: ff616461f1a16504b3a7be65eeecfdd29d31e897c43157fbd51370f72458852d + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +runtime.ext_scratch3_looks._setCostume(target, "costume2"); +runtime.ext_scratch3_looks._setCostume(target, (" " + "")); +yield* thread.procedures["ZassertTrue %b %s"](((target.currentCostume + 1) === 2),"costume should not change"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "j", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "n", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "c", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "p", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-263-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-263-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..acc5b25aebf --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-263-NaN.sb3.tw-snapshot @@ -0,0 +1,48 @@ +// TW Snapshot +// Input SHA-256: 67ab3b26c771f54d4181fa85a76430fdb4603a171c36a918cce1374c89bf9c23 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["rL_u6{W`ET;GKBRHZrag"]; +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"]((("" + (0 / 0)).toLowerCase() === "NaN".toLowerCase()),"0/0"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual((0 / 0), (0 / 0)),"NaN == NaN"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(Math.sqrt(-100), (0 / 0)),"sqrt negative"); +b0.value = (0 / 0); +yield* thread.procedures["ZassertTrue %b %s"]((("" + b0.value).toLowerCase() === "NaN".toLowerCase()),"NaN storable in variables"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "n", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "p", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "r", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "t", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-264-setCostume.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-264-setCostume.sb3.tw-snapshot new file mode 100644 index 00000000000..1bc3f57e06e --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-264-setCostume.sb3.tw-snapshot @@ -0,0 +1,75 @@ +// TW Snapshot +// Input SHA-256: 801a8e9ac5e607f022601f2eda4bddf37b29c30627f0e24864c7b0f9cf7b65f9 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["G3sNM{+Wa29PviNsXl~;"]; +return function* genXYZ () { +b0.value = "4"; +runtime.ext_scratch3_looks._setCostume(target, b0.value); +yield* thread.procedures["ZassertTrue %b %s"](((+target.getCostumes()[target.currentCostume].name || 0) === 4),"cn=4"); +yield* thread.procedures["ZassertTrue %b %s"](((target.currentCostume + 1) === 2),"c#=2"); +b0.value = 3; +runtime.ext_scratch3_looks._setCostume(target, b0.value); +yield* thread.procedures["ZassertTrue %b %s"]((target.getCostumes()[target.currentCostume].name.toLowerCase() === "costume3".toLowerCase()),"cn=costume3"); +yield* thread.procedures["ZassertTrue %b %s"](((target.currentCostume + 1) === 3),"c#=3"); +b0.value = ("" + "4"); +runtime.ext_scratch3_looks._setCostume(target, b0.value); +yield* thread.procedures["ZassertTrue %b %s"](((+target.getCostumes()[target.currentCostume].name || 0) === 4),"cn=4"); +yield* thread.procedures["ZassertTrue %b %s"](((target.currentCostume + 1) === 2),"c#=2"); +b0.value = (4 * 1); +runtime.ext_scratch3_looks._setCostume(target, b0.value); +yield* thread.procedures["ZassertTrue %b %s"]((target.getCostumes()[target.currentCostume].name.toLowerCase() === "costume4".toLowerCase()),"cn=costume4"); +yield* thread.procedures["ZassertTrue %b %s"](((target.currentCostume + 1) === 4),"c#=4"); +b0.value = "4"; +runtime.ext_scratch3_looks._setBackdrop(stage, b0.value); +yield* thread.procedures["ZassertTrue %b %s"](((+stage.getCostumes()[stage.currentCostume].name || 0) === 4),"bn=4"); +yield* thread.procedures["ZassertTrue %b %s"](((stage.currentCostume + 1) === 2),"b#=2"); +b0.value = 3; +runtime.ext_scratch3_looks._setBackdrop(stage, b0.value); +yield* thread.procedures["ZassertTrue %b %s"]((stage.getCostumes()[stage.currentCostume].name.toLowerCase() === "backdrop3".toLowerCase()),"cn=backdrop3"); +yield* thread.procedures["ZassertTrue %b %s"](((stage.currentCostume + 1) === 3),"c#=3"); +b0.value = ("" + "4"); +runtime.ext_scratch3_looks._setBackdrop(stage, b0.value); +yield* thread.procedures["ZassertTrue %b %s"](((+stage.getCostumes()[stage.currentCostume].name || 0) === 4),"bn=4"); +yield* thread.procedures["ZassertTrue %b %s"](((stage.currentCostume + 1) === 2),"b#=2"); +b0.value = (4 * 1); +runtime.ext_scratch3_looks._setBackdrop(stage, b0.value); +yield* thread.procedures["ZassertTrue %b %s"]((stage.getCostumes()[stage.currentCostume].name.toLowerCase() === "backdrop4".toLowerCase()),"bn=backdrop4"); +yield* thread.procedures["ZassertTrue %b %s"](((stage.currentCostume + 1) === 4),"b#=4"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "I", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "K", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "M", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "O", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-285-variable-id-name-desync.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-285-variable-id-name-desync.sb3.tw-snapshot new file mode 100644 index 00000000000..95718123ec2 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-285-variable-id-name-desync.sb3.tw-snapshot @@ -0,0 +1,44 @@ +// TW Snapshot +// Input SHA-256: 1accbfd57a291524a062413a9c361d51e94ac5555fd3d861dd2d56806cd7e8c7 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["T{7z:Z^j(zfah+5ca3R0"]; +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 33),"uses ID"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "h", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "j", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "l", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "n", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-56-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-56-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..c19a254e669 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-56-NaN.sb3.tw-snapshot @@ -0,0 +1,47 @@ +// TW Snapshot +// Input SHA-256: 930b81005746fcf09490be69206cf92f6b882a8d4d66ef9cfa19139090131aad + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"]((((5 + (+("" + "+") || 0)) || 0) === 5),1); +yield* thread.procedures["ZassertTrue %b %s"]((((5 + (+("" + "-") || 0)) || 0) === 5),2); +yield* thread.procedures["ZassertTrue %b %s"]((((5 + (+("" + "x") || 0)) || 0) === 5),3); +yield* thread.procedures["ZassertTrue %b %s"]((((5 + (+("" + "-=-2398749") || 0)) || 0) === 5),4); +yield* thread.procedures["ZassertTrue %b %s"]((((5 + (+("" + "") || 0)) || 0) === 5),5); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "A", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "g", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "C", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "l", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "n", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-58-list-reference.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-58-list-reference.sb3.tw-snapshot new file mode 100644 index 00000000000..7af7a095173 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-58-list-reference.sb3.tw-snapshot @@ -0,0 +1,60 @@ +// TW Snapshot +// Input SHA-256: 95f7dfd29f2a3aec8027d03eab202b439a7630a1ee6b9a7cf534c7d971e41ef7 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables[")@7t1F9WM1F[_jBWx]7["]; +const b1 = stage.variables[",VHjOaLurDh*^;8kZ~I?"]; +return function* genXYZ () { +b0.value = []; +b1.value = []; +b0.value.push(3); +b0._monitorUpToDate = false; +b0.value.push(2); +b0._monitorUpToDate = false; +b0.value.push(8); +b0._monitorUpToDate = false; +b0.value.push(4); +b0._monitorUpToDate = false; +b1.value.push(listContents(b0)); +b1._monitorUpToDate = false; +b0.value = []; +yield* thread.procedures["ZassertTrue %b %s"]((b1.value.length === 1),"output length = 1"); +yield* thread.procedures["ZassertTrue %b %s"]((b0.value.length === 0),"data length = 0"); +yield* thread.procedures["ZassertTrue %b %s"](((+(b1.value[1 - 1] ?? "") || 0) === 3284),"output item 1"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "j", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "n", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "p", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-66-insert.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-66-insert.sb3.tw-snapshot new file mode 100644 index 00000000000..874b944bb1d --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-66-insert.sb3.tw-snapshot @@ -0,0 +1,54 @@ +// TW Snapshot +// Input SHA-256: 6bac3cd99997a7deae133a560824b5dc3801b8e7e41ff3f9daab8fd6282f890f + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["$h5KnZ-ePA3NOi=];]FX"]; +return function* genXYZ () { +b0.value = []; +b0.value.unshift("a"); +b0._monitorUpToDate = false; +listInsert(b0, 2, "b"); +listInsert(b0, 3, "c"); +yield* thread.procedures["ZassertTrue %b %s"]((b0.value.length === 3),"length is 3"); +yield* thread.procedures["ZassertTrue %b %s"]((("" + (b0.value[1 - 1] ?? "")).toLowerCase() === "a".toLowerCase()),"1=a"); +yield* thread.procedures["ZassertTrue %b %s"]((("" + (b0.value[2 - 1] ?? "")).toLowerCase() === "b".toLowerCase()),"2=b"); +yield* thread.procedures["ZassertTrue %b %s"]((("" + (b0.value[3 - 1] ?? "")).toLowerCase() === "c".toLowerCase()),"3=c"); +b0.value = []; +yield* thread.procedures["ZassertTrue %b %s"]((b0.value.length === 0),"length is 0"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "l", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "n", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "p", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "r", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-70.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-70.sb3.tw-snapshot new file mode 100644 index 00000000000..ae6ab5f0f70 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-70.sb3.tw-snapshot @@ -0,0 +1,43 @@ +// TW Snapshot +// Input SHA-256: 25ae3486d45378eb1c50784721d62d71d790c4687871f5961f731f1880137db2 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"](compareEqual((("0123")[1 - 1] || ""), 0),"letter 1 of 0123 is 0"); +yield* thread.procedures["ZOK %s"](""); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "h", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "j", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "l", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "n", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-and-or-not-cast-to-boolean.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-and-or-not-cast-to-boolean.sb3.tw-snapshot new file mode 100644 index 00000000000..e1ae77aaba6 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-and-or-not-cast-to-boolean.sb3.tw-snapshot @@ -0,0 +1,27 @@ +// TW Snapshot +// Input SHA-256: 7bc7268ef7d0d00b445b003aa683b39bcdb3c4c1d4bb7ae03679f553ad22f5a6 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["q9l+ZDG${I3p$=:TPs`3"]; +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 3",}, b0, false, false, "f", null); +if ((("_" + ("" + (toBoolean((b1.value[2 - 1] ?? "")) && toBoolean((b1.value[2 - 1] ?? ""))))).toLowerCase() === "_true".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "m", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "n", null); +} +if ((("_" + ("" + (toBoolean((b1.value[1 - 1] ?? "")) || toBoolean((b1.value[2 - 1] ?? ""))))).toLowerCase() === "_true".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "q", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "r", null); +} +if (!toBoolean((b1.value[1 - 1] ?? ""))) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "v", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "w", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "u", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-befunge-eratosthenes.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-befunge-eratosthenes.sb3.tw-snapshot new file mode 100644 index 00000000000..5329a8d105f --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-befunge-eratosthenes.sb3.tw-snapshot @@ -0,0 +1,442 @@ +// TW Snapshot +// Input SHA-256: 81139c5bfe7cf38a74769e99279d2d211e5acb5dbc301dbd2bae79a6676015a3 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["Wcopy input"](); +yield* thread.procedures["Zbefunge"](); +retire(); return; +}; }) + +// Sprite1 Wcopy input +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-P-list"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-input-list"]; +return function* genXYZ_copy_input () { +b0.value = []; +b1.value = 0; +for (var a0 = b2.value.length; a0 > 0; a0--) { +b1.value = ((+b1.value || 0) + 1); +b0.value.push((b2.value[(b1.value | 0) - 1] ?? "")); +b0._monitorUpToDate = false; +if (isStuck()) yield; +} +return ""; +}; }) + +// Sprite1 Zbefunge +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-px-"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-py-"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-direction-"]; +const b3 = runtime.getSpriteTargetByName("directions"); +const b4 = b3 && b3.lookupVariableByNameAndType("RIGHT", "", true); +const b5 = stage.variables["o4+OyKx[M=quu6p{=kRl-mem-list"]; +const b6 = stage.variables["4s|,s}H*n$XE+1ez}%eC"]; +return function* genXYZ_befunge () { +b0.value = 1; +b1.value = 1; +b2.value = (b4 ? b4.value : 0); +b5.value = []; +b6.value = []; +yield* thread.procedures["Wget max length"](); +while (true) { +yield* thread.procedures["Zstep"](); +yield; +} +return ""; +}; }) + +// Sprite1 Wget max length +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-max length-"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-input-list"]; +return function* genXYZ_get_max_length () { +b0.value = 0; +b1.value = 0; +for (var a0 = b2.value.length; a0 > 0; a0--) { +b1.value = ((+b1.value || 0) + 1); +if (compareGreaterThan(("" + (b2.value[(b1.value | 0) - 1] ?? "")).length, b0.value)) { +b0.value = ("" + (b2.value[(b1.value | 0) - 1] ?? "")).length; +} +if (isStuck()) yield; +} +return ""; +}; }) + +// Sprite1 Zstep +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-char-"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-P-list"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-py-"]; +const b3 = stage.variables["o4+OyKx[M=quu6p{=kRl-px-"]; +const b4 = stage.variables["o4+OyKx[M=quu6p{=kRl-direction-"]; +const b5 = runtime.getSpriteTargetByName("directions"); +const b6 = b5 && b5.lookupVariableByNameAndType("RIGHT", "", true); +const b7 = b5 && b5.lookupVariableByNameAndType("LEFT", "", true); +const b8 = b5 && b5.lookupVariableByNameAndType("UP", "", true); +const b9 = b5 && b5.lookupVariableByNameAndType("DOWN", "", true); +const b10 = stage.variables["o4+OyKx[M=quu6p{=kRl-pop-list"]; +const b11 = stage.variables["o4+OyKx[M=quu6p{=kRl-result-"]; +const b12 = stage.variables["o4+OyKx[M=quu6p{=kRl-mem-list"]; +const b13 = stage.variables["4s|,s}H*n$XE+1ez}%eC"]; +const b14 = stage.variables["o4+OyKx[M=quu6p{=kRl-ascii-list"]; +const b15 = stage.variables["o4+OyKx[M=quu6p{=kRl-ascii2-list"]; +const b16 = stage.variables["o4+OyKx[M=quu6p{=kRl-numbers-list"]; +return function* genXYZ_step () { +b0.value = ((("" + listGet(b1.value, b2.value)))[((+b3.value) | 0) - 1] || ""); +if ((b0.value.toLowerCase() === ">".toLowerCase())) { +b4.value = (b6 ? b6.value : 0); +} +if ((b0.value.toLowerCase() === "<".toLowerCase())) { +b4.value = (b7 ? b7.value : 0); +} +if ((b0.value.toLowerCase() === "^".toLowerCase())) { +b4.value = (b8 ? b8.value : 0); +} +if ((b0.value.toLowerCase() === "v".toLowerCase())) { +b4.value = (b9 ? b9.value : 0); +} +if ((b0.value.toLowerCase() === "?".toLowerCase())) { +b4.value = randomInt(1, 4); +} +if ((b0.value.toLowerCase() === "@".toLowerCase())) { +yield* thread.procedures["Zexit & verify"](); +} +if ((("" + b0.value).toLowerCase() === "+".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"](((+(b10.value[1 - 1] ?? "") || 0) + (+(b10.value[2 - 1] ?? "") || 0))); +} +if ((("" + b0.value).toLowerCase() === "-".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"](((+(b10.value[2 - 1] ?? "") || 0) - (+(b10.value[1 - 1] ?? "") || 0))); +} +if ((("" + b0.value).toLowerCase() === "*".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"](((+(b10.value[2 - 1] ?? "") || 0) * (+(b10.value[1 - 1] ?? "") || 0))); +} +if ((("" + b0.value).toLowerCase() === "/".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"](Math.floor((((+(b10.value[2 - 1] ?? "") || 0) / (+(b10.value[1 - 1] ?? "") || 0)) || 0))); +} +if ((("" + b0.value).toLowerCase() === "%".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"](mod((+(b10.value[2 - 1] ?? "") || 0), (+(b10.value[1 - 1] ?? "") || 0))); +} +if ((("" + b0.value).toLowerCase() === "!".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +thread.procedures["Zpush bool %b"](compareEqual((b10.value[1 - 1] ?? ""), 0)); +} +if ((("" + b0.value).toLowerCase() === "`".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush bool %b"](compareGreaterThan((b10.value[2 - 1] ?? ""), (b10.value[1 - 1] ?? ""))); +} +if ((("" + b0.value).toLowerCase() === "_".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +if ((compareEqual((b10.value[1 - 1] ?? ""), 0) || (("" + (b10.value[1 - 1] ?? "")).toLowerCase() === "".toLowerCase()))) { +b4.value = (b6 ? b6.value : 0); +} else { +b4.value = (b7 ? b7.value : 0); +} +} +if ((("" + b0.value).toLowerCase() === "|".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +if ((compareEqual((b10.value[1 - 1] ?? ""), 0) || (("" + (b10.value[1 - 1] ?? "")).toLowerCase() === "".toLowerCase()))) { +b4.value = (b9 ? b9.value : 0); +} else { +b4.value = (b8 ? b8.value : 0); +} +} +if ((("" + b0.value).toLowerCase() === "\"".toLowerCase())) { +yield* thread.procedures["Znext char"](); +while (!(((("" + listGet(b1.value, b2.value)))[((+b3.value) | 0) - 1] || "").toLowerCase() === "\"".toLowerCase())) { +yield* thread.procedures["Wascii to number %s"](((("" + listGet(b1.value, b2.value)))[((+b3.value) | 0) - 1] || "")); +thread.procedures["Zpush %n"](b11.value); +yield* thread.procedures["Znext char"](); +yield; +} +} +if ((("" + b0.value).toLowerCase() === ":".toLowerCase())) { +thread.procedures["Zpush %n"]((b12.value[b12.value.length - 1] ?? "")); +} +if ((("" + b0.value).toLowerCase() === "\\".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +thread.procedures["Zpush %n"]((b10.value[1 - 1] ?? "")); +thread.procedures["Zpush %n"]((b10.value[2 - 1] ?? "")); +} +if ((("" + b0.value).toLowerCase() === "$".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +} +if ((("" + b0.value).toLowerCase() === ".".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +b13.value.push((b10.value[1 - 1] ?? "")); +b13._monitorUpToDate = false; +} +if ((("" + b0.value).toLowerCase() === ",".toLowerCase())) { +yield* thread.procedures["Zpop %n"](1); +yield* thread.procedures["ZFAIL %s"](("did not expect ascii output: " + ("" + (b14.value[(((+(b10.value[1 - 1] ?? "") || 0) + 1) | 0) - 1] ?? "")))); +} +if ((("" + b0.value).toLowerCase() === "#".toLowerCase())) { +yield* thread.procedures["Znext char"](); +} +if ((("" + b0.value).toLowerCase() === "g".toLowerCase())) { +yield* thread.procedures["Zpop %n"](2); +yield* thread.procedures["Zascii to number but it lies %s"](((("" + (b1.value[(((+(b10.value[1 - 1] ?? "") || 0) + 1) | 0) - 1] ?? "")))[(((+(b10.value[2 - 1] ?? "") || 0) + 1) | 0) - 1] || "")); +thread.procedures["Zpush %n"](b11.value); +} +if ((("" + b0.value).toLowerCase() === "p".toLowerCase())) { +yield* thread.procedures["Zpop %n"](3); +listReplace(b10, 1, ((+(b10.value[1 - 1] ?? "") || 0) + 1)); +listReplace(b10, 2, ((+(b10.value[2 - 1] ?? "") || 0) + 1)); +if (compareLessThan(b1.value.length, (b10.value[1 - 1] ?? ""))) { +while (!compareEqual(b1.value.length, (b10.value[1 - 1] ?? ""))) { +b1.value.push(""); +b1._monitorUpToDate = false; +yield; +} +} +if (compareLessThan(("" + listGet(b1.value, (b10.value[1 - 1] ?? ""))).length, (b10.value[2 - 1] ?? ""))) { +while (!compareEqual(("" + listGet(b1.value, (b10.value[1 - 1] ?? ""))).length, (b10.value[2 - 1] ?? ""))) { +listReplace(b1, (b10.value[1 - 1] ?? ""), (("" + listGet(b1.value, (b10.value[1 - 1] ?? ""))) + " ")); +yield; +} +} +yield* thread.procedures["Winsert %s %n %s"](listGet(b1.value, (b10.value[1 - 1] ?? "")),(b10.value[2 - 1] ?? ""),(b15.value[(((+(b10.value[3 - 1] ?? "") || 0) + 1) | 0) - 1] ?? "")); +listReplace(b1, (b10.value[1 - 1] ?? ""), b11.value); +} +if ((("" + b0.value).toLowerCase() === "&".toLowerCase())) { +yield* thread.procedures["ZFAIL %s"]("unexpected ask for integer input"); +} +if ((("" + b0.value).toLowerCase() === "~".toLowerCase())) { +yield* thread.procedures["ZFAIL %s"]("unexpected ask for ascii input"); +} +if (listContains(b16, b0.value)) { +thread.procedures["Zpush %n"](b0.value); +} +yield* thread.procedures["Znext char"](); +return ""; +}; }) + +// Sprite1 Zexit & verify +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["4s|,s}H*n$XE+1ez}%eC"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +const b2 = stage.variables["f]9Ph]^v5P2CT7ju($Qb"]; +return function* genXYZ_exit___verify () { +yield* thread.procedures["ZassertTrue %b %s"]((b0.value.length === 22),"should output 22 items"); +b1.value = 0; +for (var a0 = b0.value.length; a0 > 0; a0--) { +b1.value = ((+b1.value || 0) + 1); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(listGet(b0.value, b1.value), listGet(b2.value, b1.value)),("item " + (("" + b1.value) + " should match expected output"))); +yield; +} +yield* thread.procedures["ZOKAY %s"]((("" + runtime.ioDevices.clock.projectTimer()) + " seconds")); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 Zpop %n +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-pop-list"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-mem-list"]; +return function* genXYZ_pop_ (p0) { +b0.value = []; +for (var a0 = (+p0 || 0); a0 >= 0.5; a0--) { +if ((b1.value.length > 0)) { +b0.value.push((b1.value[b1.value.length - 1] ?? "")); +b0._monitorUpToDate = false; +b1.value.pop(); +b1._monitorUpToDate = false; +} else { +b0.value.push(0); +b0._monitorUpToDate = false; +} +yield; +} +return ""; +}; }) + +// Sprite1 Zpush %n +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-mem-list"]; +return function funXYZ_push_ (p0) { +b0.value.push(p0); +b0._monitorUpToDate = false; +return ""; +}; }) + +// Sprite1 Zpush bool %b +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function funXYZ_push_bool_ (p0) { +if (toBoolean(p0)) { +thread.procedures["Zpush %n"](1); +} else { +thread.procedures["Zpush %n"](0); +} +return ""; +}; }) + +// Sprite1 Znext char +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-direction-"]; +const b1 = runtime.getSpriteTargetByName("directions"); +const b2 = b1 && b1.lookupVariableByNameAndType("RIGHT", "", true); +const b3 = stage.variables["o4+OyKx[M=quu6p{=kRl-px-"]; +const b4 = b1 && b1.lookupVariableByNameAndType("LEFT", "", true); +const b5 = b1 && b1.lookupVariableByNameAndType("UP", "", true); +const b6 = stage.variables["o4+OyKx[M=quu6p{=kRl-py-"]; +const b7 = b1 && b1.lookupVariableByNameAndType("DOWN", "", true); +const b8 = runtime.getOpcodeFunction("sensing_askandwait"); +const b9 = stage.variables["o4+OyKx[M=quu6p{=kRl-P-list"]; +const b10 = stage.variables["o4+OyKx[M=quu6p{=kRl-max length-"]; +return function* genXYZ_next_char () { +if (compareEqual(b0.value, (b2 ? b2.value : 0))) { +b3.value = ((+b3.value || 0) + 1); +} else { +if (compareEqual(b0.value, (b4 ? b4.value : 0))) { +b3.value = ((+b3.value || 0) + -1); +} else { +if (compareEqual(b0.value, (b5 ? b5.value : 0))) { +b6.value = ((+b6.value || 0) + -1); +} else { +if (compareEqual(b0.value, (b7 ? b7.value : 0))) { +b6.value = ((+b6.value || 0) + 1); +} else { +yield* executeInCompatibilityLayer({"QUESTION":("ERROR: Unkown direction (" + (("" + b0.value) + ")")),}, b8, false, false, "/", null); +runtime.stopAll(); +retire(); yield; +} +} +} +} +if (compareGreaterThan(b6.value, b9.value.length)) { +b6.value = 1; +} +if (compareLessThan(b6.value, 0)) { +b6.value = b9.value.length; +} +if (compareGreaterThan(b3.value, b10.value)) { +b3.value = 1; +} +if (compareLessThan(b3.value, 0)) { +b3.value = b10.value; +} +return ""; +}; }) + +// Sprite1 Wascii to number %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-costumes-list"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-result-"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +const b3 = stage.variables["o4+OyKx[M=quu6p{=kRl-ascii-list"]; +return function* genXYZ_ascii_to_number_ (p0) { +if (listContains(b0, p0)) { +runtime.ext_scratch3_looks._setCostume(target, p0); +if (((target.currentCostume + 1) > 26)) { +b1.value = ((target.currentCostume + 1) + 38); +} else { +b1.value = ((target.currentCostume + 1) + 96); +} +} else { +b2.value = 0; +for (var a0 = b3.value.length; a0 > 0; a0--) { +b2.value = ((+b2.value || 0) + 1); +if (compareEqual((b3.value[(b2.value | 0) - 1] ?? ""), p0)) { +b1.value = (b2.value - 1); +return ""; +} +if (isStuck()) yield; +} +b1.value = -1; +} +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "aF", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + "0"),}, b0, false, false, "+", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "aH", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 Zascii to number but it lies %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-costumes-list"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-result-"]; +const b2 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +const b3 = stage.variables["o4+OyKx[M=quu6p{=kRl-ascii2-list"]; +return function* genXYZ_ascii_to_number_but_ (p0) { +if (listContains(b0, p0)) { +runtime.ext_scratch3_looks._setCostume(target, p0); +if (((target.currentCostume + 1) > 26)) { +b1.value = ((target.currentCostume + 1) + 38); +} else { +b1.value = ((target.currentCostume + 1) + 96); +} +} else { +b2.value = 0; +for (var a0 = b3.value.length; a0 > 0; a0--) { +b2.value = ((+b2.value || 0) + 1); +if (compareEqual((b3.value[(b2.value | 0) - 1] ?? ""), p0)) { +b1.value = (b2.value - 1); +return ""; +} +yield; +} +b1.value = 0; +} +return ""; +}; }) + +// Sprite1 Winsert %s %n %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["o4+OyKx[M=quu6p{=kRl-result-"]; +const b1 = stage.variables["o4+OyKx[M=quu6p{=kRl-i-"]; +return function* genXYZ_insert___ (p0,p1,p2) { +b0.value = ""; +b1.value = 0; +for (var a0 = ((+p1 || 0) - 1); a0 >= 0.5; a0--) { +b1.value = ((+b1.value || 0) + 1); +b0.value = (("" + b0.value) + ((("" + p0))[(b1.value | 0) - 1] || "")); +if (isStuck()) yield; +} +b0.value = (("" + b0.value) + ("" + p2)); +b1.value = ((+b1.value || 0) + 1); +for (var a1 = (("" + p0).length - (+b1.value || 0)); a1 >= 0.5; a1--) { +b1.value = ((+b1.value || 0) + 1); +b0.value = (("" + b0.value) + ((("" + p0))[(b1.value | 0) - 1] || "")); +if (isStuck()) yield; +} +return ""; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOKAY %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OKAY_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "aB", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + "0"),}, b0, false, false, "*", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "aD", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-broadcast-self-restart-delay.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-broadcast-self-restart-delay.sb3.tw-snapshot new file mode 100644 index 00000000000..4dba7109918 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-broadcast-self-restart-delay.sb3.tw-snapshot @@ -0,0 +1,61 @@ +// TW Snapshot +// Input SHA-256: a018442bac20400dc82b159894be4f188118b41c2f85528416cdbe2eb221b01f + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +const b1 = stage.variables["XpJYYJ:ZH%1jU!x!l(ZP"]; +return function* genXYZ () { +b0.value = 0; +b1.value = 0; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +while (true) { +b1.value = 0; +yield; +} +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +const b1 = stage.variables["XpJYYJ:ZH%1jU!x!l(ZP"]; +return function* genXYZ () { +if (compareGreaterThan(b0.value, 3)) { +if (compareLessThan(b1.value, b0.value)) { +yield* thread.procedures["ZOK %s"](""); +} else { +yield* thread.procedures["ZFAIL %s"](""); +} +} else { +target.setCostume(target.currentCostume + 1); +b0.value = ((+b0.value || 0) + 1); +b1.value = ((+b1.value || 0) + 1); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +} +retire(); return; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "e", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "c", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "g", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "i", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "d", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "k", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-cannot-forceQueue-after-broadcast.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-cannot-forceQueue-after-broadcast.sb3.tw-snapshot new file mode 100644 index 00000000000..61b6860cd27 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-cannot-forceQueue-after-broadcast.sb3.tw-snapshot @@ -0,0 +1,37 @@ +// TW Snapshot +// Input SHA-256: a9d53758e603b449818a648433944c2775495122dab210fdaca971ab4f121a27 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "b", null); +b1.value = 0; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1" }); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +const b1 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +b0.value = ((+b0.value || 0) + 1); +if ((b0.value === 1)) { +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1" }); +thread.timer = timer(); +var a0 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a0) { +yield; +} +thread.timer = null; +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b1, false, false, "l", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b1, false, false, "e", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b1, false, false, "m", null); +} +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-change-size-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-change-size-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..d93fb2bafa3 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-change-size-NaN.sb3.tw-snapshot @@ -0,0 +1,18 @@ +// TW Snapshot +// Input SHA-256: 794320c6ad6c499d6c1e160d8cd1df690fbf045e158faef0df130a0e07560e2b + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "d", null); +target.setSize(100); +target.setSize(target.size + ((0 / 0) || 0)); +if ((Math.round(target.size) === 100)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "j", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-costume-name-infinity-nan.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-costume-name-infinity-nan.sb3.tw-snapshot new file mode 100644 index 00000000000..6c1aee826ce --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-costume-name-infinity-nan.sb3.tw-snapshot @@ -0,0 +1,35 @@ +// TW Snapshot +// Input SHA-256: dad2d51129eae742bdde75772afed267945ce57ccbc8890e504519ff6fd55318 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +runtime.ext_scratch3_looks._setCostume(target, "initial"); +yield* executeInCompatibilityLayer({"MESSAGE":"plan 6",}, b0, false, false, "m", null); +runtime.ext_scratch3_looks._setCostume(target, (1 / 0)); +if ((target.getCostumes()[target.currentCostume].name.toLowerCase() === "good".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass infinity costume name",}, b0, false, false, "x", null); +} +if (((target.currentCostume + 1) === 1)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass infinity costume number",}, b0, false, false, "z", null); +} +runtime.ext_scratch3_looks._setCostume(target, "initial"); +runtime.ext_scratch3_looks._setCostume(target, (1 / -0)); +if ((target.getCostumes()[target.currentCostume].name.toLowerCase() === "good".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -infinity costume name",}, b0, false, false, "E", null); +} +if (((target.currentCostume + 1) === 1)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -infinity costume number",}, b0, false, false, "G", null); +} +runtime.ext_scratch3_looks._setCostume(target, "initial"); +runtime.ext_scratch3_looks._setCostume(target, (0 / 0)); +if ((target.getCostumes()[target.currentCostume].name.toLowerCase() === "good".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass nan costume name",}, b0, false, false, "L", null); +} +if (((target.currentCostume + 1) === 1)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass nan costume number",}, b0, false, false, "O", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "N", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-for-each-in.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-for-each-in.sb3.tw-snapshot new file mode 100644 index 00000000000..ce167385193 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-for-each-in.sb3.tw-snapshot @@ -0,0 +1,134 @@ +// TW Snapshot +// Input SHA-256: 4a00d758e882b2fe0b57020459268c0db38afb7aee290e57f045a5dab2ece743 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["om$AKtHax/H0kJUzYbbi"]; +const b1 = stage.variables["7Oj/v$#js7a33uH`xGl;"]; +return function* genXYZ () { +b0.value = "no change"; +b1.value = 0; +var a0 = 0; while (a0 < 10) { a0++; b0.value = a0; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 10),"i = 10 (each 10)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 10),"dummy = 10 (each 10)"); +b0.value = "no change"; +b1.value = 0; +var a1 = 0; while (a1 < 1) { a1++; b0.value = a1; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 1),"i = 1 (each 1)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 1),"dummy = 1 (each 1)"); +b0.value = "no change"; +b1.value = 0; +var a2 = 0; while (a2 < 0) { a2++; b0.value = a2; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"]((("" + b0.value).toLowerCase() === "no change".toLowerCase()),"i = no change (each 0)"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(b1.value, 0),"dummy = 0 (each 0)"); +b0.value = "no change"; +b1.value = 0; +var a3 = 0; while (a3 < -5) { a3++; b0.value = a3; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"]((("" + b0.value).toLowerCase() === "no change".toLowerCase()),"i = no change (each -5)"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(b1.value, 0),"dummy = 0 (each -5)"); +b0.value = "no change"; +b1.value = 0; +var a4 = 0; while (a4 < 0) { a4++; b0.value = a4; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"]((("" + b0.value).toLowerCase() === "no change".toLowerCase()),"i = no change (each aaaaaa)"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(b1.value, 0),"dummy = 0 (each aaaaaa)"); +b0.value = "no change"; +b1.value = 0; +var a5 = 0; while (a5 < 5.9) { a5++; b0.value = a5; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 6),"i = 6 (each 5.9)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 6),"dummy = 6 (each 5.9)"); +b0.value = "no change"; +b1.value = 0; +var a6 = 0; while (a6 < 5.1) { a6++; b0.value = a6; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 6),"i = 6 (each 5.1)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 6),"dummy = 6 (each 5.1)"); +b0.value = "no change"; +b1.value = 0; +var a7 = 0; while (a7 < -0.1) { a7++; b0.value = a7; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"]((("" + b0.value).toLowerCase() === "no change".toLowerCase()),"i = no change (each -0.1)"); +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(b1.value, 0),"dummy = 0 (each -0.1)"); +b0.value = "no change"; +b1.value = 0; +var a8 = 0; while (a8 < 0.1) { a8++; b0.value = a8; +b1.value = ((+b1.value || 0) + 1); +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 1),"i = 1 (each 0.1)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 1),"dummy = 1 (each 0.1)"); +b0.value = "no change"; +var a9 = 0; while (a9 < 5) { a9++; b0.value = a9; +b0.value = 8; +b1.value = 9; +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 8),"i = 8 (each 5 w/set)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 9),"dummy = 9 (each 5 w/set)"); +b0.value = "no change"; +b1.value = 1; +var a10 = 0; while (a10 < 5) { a10++; b0.value = a10; +yield* thread.procedures["ZassertTrue %b %s"](compareEqual(b0.value, b1.value),"i = dummy (each 5 w/set+dummy check)"); +b1.value = ((+b1.value || 0) + 1); +b0.value = 9999; +yield; +} +yield* thread.procedures["ZassertTrue %b %s"](((+b0.value || 0) === 9999),"i = 9999 (after each 5 w/set+dummy check)"); +yield* thread.procedures["ZassertTrue %b %s"](((+b1.value || 0) === 6),"dummy = 6 (after each 5 w/set+dummy check)"); +yield* thread.procedures["ZOK %s"]("ok"); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "O", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "Q", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "S", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "U", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-glide-negative-time.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-glide-negative-time.sb3.tw-snapshot new file mode 100644 index 00000000000..24acc11d952 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-glide-negative-time.sb3.tw-snapshot @@ -0,0 +1,43 @@ +// TW Snapshot +// Input SHA-256: 02a87b5a1b3b7a692c904422b1b22ea0fb6a7240ab3ca998a921674f4152b04e + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +thread.timer = timer(); +var a0 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a0) { +yield; +} +thread.timer = null; +thread.timer = timer(); +var a1 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a1) { +yield; +} +thread.timer = null; +if ((limitPrecision(target.x) === 100)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "m", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "n", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", null); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = runtime.getOpcodeFunction("motion_glidesecstoxy"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "d", null); +target.setXY(0, 0); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +yield* executeInCompatibilityLayer({"SECS":-1,"X":100,"Y":0,}, b1, false, false, "h", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-glide-xy-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-glide-xy-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..349094412fa --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-glide-xy-NaN.sb3.tw-snapshot @@ -0,0 +1,19 @@ +// TW Snapshot +// Input SHA-256: 052a07292a98c770d3cdf1df2670a8eb2c4e488041187e45e7ffb6e8944013b6 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = runtime.getOpcodeFunction("motion_glidesecstoxy"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "d", null); +target.setXY(-100, -100); +yield* executeInCompatibilityLayer({"SECS":0,"X":(0 / 0),"Y":100,}, b1, false, false, "b", null); +if ((limitPrecision(target.x) === 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "j", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-mathop-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-mathop-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..59e376d2266 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-mathop-NaN.sb3.tw-snapshot @@ -0,0 +1,37 @@ +// TW Snapshot +// Input SHA-256: 082b59a5b772f80c84bc6a846d9ea5023863d8f90c5b85e599b53fed7a9d6a46 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 8",}, b0, false, false, "j", null); +b1.value = (1 / 0); +if (((10 + (Math.sqrt(-1) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "R", null); +} +if (((10 + ((Math.round(Math.sin((Math.PI * (+b1.value || 0)) / 180) * 1e10) / 1e10) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "B", null); +} +if (((10 + ((Math.round(Math.cos((Math.PI * (+b1.value || 0)) / 180) * 1e10) / 1e10) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "D", null); +} +if (((10 + (tan((+b1.value || 0)) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "F", null); +} +if (((10 + (((Math.asin(2) * 180) / Math.PI) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "H", null); +} +if (((10 + (((Math.acos(2) * 180) / Math.PI) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "J", null); +} +if (((10 + (Math.log(-1) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "L", null); +} +if (((10 + ((Math.log(-1) / Math.LN10) || 0)) === 10)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "O", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "N", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-negative-zero.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-negative-zero.sb3.tw-snapshot new file mode 100644 index 00000000000..8fdbb26b8f4 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-negative-zero.sb3.tw-snapshot @@ -0,0 +1,44 @@ +// TW Snapshot +// Input SHA-256: 392c8fcd9ce3e05cfb9ec1f39713073fca6c3a702fbd49697e2e496376e6b4f6 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["ZassertTrue %b %s"]((((1 / 0) || 0) === Infinity),"1/0"); +yield* thread.procedures["ZassertTrue %b %s"]((((1 / -0) || 0) === -Infinity),"1/-0"); +yield* thread.procedures["ZOK %s"]("ok"); +retire(); return; +}; }) + +// Sprite1 ZassertTrue %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assertTrue__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "i", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "k", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "m", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "o", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-operators-output-NaN.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-operators-output-NaN.sb3.tw-snapshot new file mode 100644 index 00000000000..042ff267e16 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-operators-output-NaN.sb3.tw-snapshot @@ -0,0 +1,27 @@ +// TW Snapshot +// Input SHA-256: 289d73b9be2b60f501e57768410029798d2dec7d971e5935e5f19fb2a9988169 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["k|@-`:^^Mo+E}$({|2/P"]; +const b2 = stage.variables["t2m05.oW;5f0=GL30@pV"]; +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 4",}, b0, false, false, "g", null); +b1.value = (1 / 0); +b2.value = (-1 / 0); +if ((("" + (b1.value + b2.value)).toLowerCase() === "NaN".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 1",}, b0, false, false, "m", null); +} +if ((("" + ((+b1.value || 0) - (+b1.value || 0))).toLowerCase() === "NaN".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 1",}, b0, false, false, "n", null); +} +if ((("" + ((+b1.value || 0) * 0)).toLowerCase() === "NaN".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 1",}, b0, false, false, "o", null); +} +if ((("" + (0 / 0)).toLowerCase() === "NaN".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 1",}, b0, false, false, "q", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "p", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-operators.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-operators.sb3.tw-snapshot new file mode 100644 index 00000000000..410134f99b6 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-operators.sb3.tw-snapshot @@ -0,0 +1,165 @@ +// TW Snapshot +// Input SHA-256: 1142c0dcd16b015bae6b8df3e70e1e4572decc653e0c5f4af57a9a7313e8d458 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["Zassert %b %s"]((((0.1 + 0.2) || 0) === 0.30000000000000004),"adding must work w/ floating point errors"); +yield* thread.procedures["Zassert %b %s"]((((0.2 - -0.1) || 0) === 0.30000000000000004),"subtraction must work w/ floating point errors"); +yield* thread.procedures["Zassert %b %s"]((((0 - 5) || 0) === -5),"substraction should invert with empty right side"); +yield* thread.procedures["Zassert %b %s"]((((222 * 2) || 0) === 444),"multiplication must work"); +yield* thread.procedures["Zassert %b %s"]((((222 / 2) || 0) === 111),"division must work"); +yield* thread.procedures["Zassert %b %s"]((((100 / 0) || 0) === Infinity),"100/0 must equal Infinity"); +for (var a0 = 5; a0 > 0; a0--) { +yield* thread.procedures["Zassert %b %s"](!(randomInt(1, 10) < 1),"pick random should have a lower bound (inclusive)"); +yield* thread.procedures["Zassert %b %s"](!(randomInt(1, 10) > 10),"pick random should have an upper bound (inclusive)"); +yield* thread.procedures["Zassert %b %s"]((1 === 1),"pick random of range 0 should return either bound"); +yield* thread.procedures["Zassert %b %s"](!compareEqual(mod((randomFloat(1, 2) || 0), 1), 0),"pick random w/ decimal bounds should return decimals"); +yield* thread.procedures["Zassert %b %s"](!compareEqual(mod((randomFloat(1, 2) || 0), 1), 0),"pick random w/ decimal (.0) bounds should return decimals"); +yield* thread.procedures["Zassert %b %s"](!compareEqual(mod((randomFloat(1, 2) || 0), 1), 0),"pick random w/ decimal (.0) bounds should return decimals"); +yield* thread.procedures["Zassert %b %s"](!compareEqual(mod((randomFloat(1.1, 2) || 0), 1), 0),"pick random w/ decimal bounds should return decimals"); +yield* thread.procedures["Zassert %b %s"](!compareEqual(mod((randomFloat(1, 2.1) || 0), 1), 0),"pick random w/ decimal bounds should return decimals"); +yield; +} +yield* thread.procedures["Zassert %b %s"]((1 > 0),"1 must be greater than 0"); +yield* thread.procedures["Zassert %b %s"](!(0 > 1),"0 must not be greater than 1"); +yield* thread.procedures["Zassert %b %s"]((0 < 1),"0 must be less than 1"); +yield* thread.procedures["Zassert %b %s"](!(1 < 0),"1 must not be greater than 1"); +yield* thread.procedures["Zassert %b %s"]((1 === 1),"1 must equal 1"); +yield* thread.procedures["Zassert %b %s"](!("hello".toLowerCase() === "world".toLowerCase()),"hello must not equal world"); +yield* thread.procedures["Zassert %b %s"](("hello".toLowerCase() === "hello".toLowerCase()),"hello must equal hello"); +yield* thread.procedures["Zassert %b %s"](("".toLowerCase() === "".toLowerCase()),"empty must equal empty"); +yield* thread.procedures["Zassert %b %s"](!(" ".toLowerCase() === "".toLowerCase()),"spaces must not be ignored in equal"); +yield* thread.procedures["Zassert %b %s"](("👌".toLowerCase() === "👌".toLowerCase()),"equal should support emoji"); +yield* thread.procedures["Zassert %b %s"](!(0.30000000000000004 === 0.3),"number comparison must be precise"); +yield* thread.procedures["Zassert %b %s"]((0.1 === 0.1),"number comparison should disregard following zeros"); +yield* thread.procedures["Zassert %b %s"]((0.1 === 0.1),"number comparison should disregard leading zeros"); +yield* thread.procedures["Zassert %b %s"](compareEqual((0 / 0), (0 / 0)),"number NaN must equal number NaN"); +yield* thread.procedures["Zassert %b %s"](!false,"empty negate must be true"); +yield* thread.procedures["Zassert %b %s"](!!!false,"negate true must be false"); +yield* thread.procedures["Zassert %b %s"](!!!!!!!false,"negates must be stackable to the moon"); +yield* thread.procedures["Zassert %b %s"]((("apple " + "banana").toLowerCase() === "apple banana".toLowerCase()),"join must join strings"); +yield* thread.procedures["Zassert %b %s"](((("apple")[1 - 1] || "").toLowerCase() === "a".toLowerCase()),"letter 1 of apple must be apple"); +yield* thread.procedures["Zassert %b %s"](((("apple")[0 - 1] || "").toLowerCase() === "".toLowerCase()),"letter 0 of apple must be empty"); +yield* thread.procedures["Zassert %b %s"](((("apple")[((0 - 1) | 0) - 1] || "").toLowerCase() === "".toLowerCase()),"letter -1 of apple must be empty"); +yield* thread.procedures["Zassert %b %s"](((("apple")[9999 - 1] || "").toLowerCase() === "".toLowerCase()),"letter 9999 of apple must be empty"); +yield* thread.procedures["Zassert %b %s"](("apple".length === 5),"length of apple must be 5"); +yield* thread.procedures["Zassert %b %s"](("".length === 0),"length of empty string must be 0"); +yield* thread.procedures["Zassert %b %s"](("apple".toLowerCase().indexOf("a".toLowerCase()) !== -1),"apple must contain a"); +yield* thread.procedures["Zassert %b %s"](!("apple".toLowerCase().indexOf("b".toLowerCase()) !== -1),"apple must not contain b"); +yield* thread.procedures["Zassert %b %s"](!("👌".toLowerCase().indexOf("👏".toLowerCase()) !== -1),"👌 must not contain 👏"); +yield* thread.procedures["Zassert %b %s"](("👌👌".toLowerCase().indexOf("👌".toLowerCase()) !== -1),"👌👌 must contain 👌"); +yield* thread.procedures["Zassert %b %s"](((mod(3, 4) || 0) === 3),"3 mod 4 must be 3"); +yield* thread.procedures["Zassert %b %s"](((mod(3, -4) || 0) === -1),"3 mod -4 must be -1"); +yield* thread.procedures["Zassert %b %s"](((mod(-3, 4) || 0) === 1),"-3 mod 4 must be 1"); +yield* thread.procedures["Zassert %b %s"](compareEqual(mod(3, 3), 0),"a number mod itself must be 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual(mod(-3, 3), 0),"a number mod it's positive inverse must be 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual(mod(3, -3), 0),"a number mod it's negative inverse must be 0"); +yield* thread.procedures["Zassert %b %s"]((("" + mod(3, 0)).toLowerCase() === "NaN".toLowerCase()),"any number mod 0 must be NaN"); +yield* thread.procedures["Zassert %b %s"](((mod(1.5, 1) || 0) === 0.5),"mod 1 must result in only decimal part"); +yield* thread.procedures["Zassert %b %s"](((mod(3.3, 1) || 0) === 0.2999999999999998),"3.3 mod 1 must have floating point errors"); +yield* thread.procedures["Zassert %b %s"]((Math.round(0) === 0),"rounding 0 must be 0"); +yield* thread.procedures["Zassert %b %s"]((Math.round(0.1) === 0),"rounding .1 must be 0"); +yield* thread.procedures["Zassert %b %s"]((Math.round(0.9) === 1),"rounding .9 must be 1"); +yield* thread.procedures["Zassert %b %s"]((Math.round(-0.5) === 0),"rounding -.5 must be 0"); +yield* thread.procedures["Zassert %b %s"]((Math.round(-0.1) === 0),"roudning -.1 must be 0"); +yield* thread.procedures["Zassert %b %s"]((Math.round(-0.51) === -1),"roudning -.51 must be -1"); +yield* thread.procedures["Zassert %b %s"](((+!false) === 1),"true must equal 1"); +yield* thread.procedures["Zassert %b %s"](((+!!false) === 0),"false must equal 0"); +yield* thread.procedures["Zassert %b %s"]((((9007199254740992 + 1) || 0) === 9007199254740992),"math should start breaking after 9007199254740991"); +yield* thread.procedures["Zassert %b %s"]((Math.abs(5) === 5),"absolute value of a position number should be itself"); +yield* thread.procedures["Zassert %b %s"]((Math.abs(-5) === 5),"absolute value of a negative number should be its inverse"); +yield* thread.procedures["Zassert %b %s"]((Math.floor(5.9) === 5),"floor of a number should round it down"); +yield* thread.procedures["Zassert %b %s"]((Math.ceil(5.9) === 6),"ceiling of a number should round it up"); +yield* thread.procedures["Zassert %b %s"](((Math.sqrt(4) || 0) === 2),"sqrt of 4 must be 2"); +yield* thread.procedures["Zassert %b %s"](((Math.sqrt(2) || 0) === 1.4142135623730951),"sqrt of 2 must be 1.4142135623730951"); +yield* thread.procedures["Zassert %b %s"]((Math.round((((Math.asin(0.5) * 180) / Math.PI) || 0)) === 30),"asin of .5 must be roughly 30"); +yield* thread.procedures["Zassert %b %s"](compareEqual(Math.log(1), 0),"ln 1 must be 0"); +yield* thread.procedures["Zassert %b %s"](((Math.log(2) || 0) === 0.6931471805599453),"ln 2 must be 0.69314..."); +yield* thread.procedures["Zassert %b %s"](((Math.log(2.718281828459045) || 0) === 1),"ln e must be 1"); +yield* thread.procedures["Zassert %b %s"](((Math.log(Math.exp(2)) || 0) === 2),"ln e^2 must be 2"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.log(1) / Math.LN10), 0),"log 1 must be 0"); +yield* thread.procedures["Zassert %b %s"]((((Math.log(2) / Math.LN10) || 0) === 0.30102999566398114),"log 2 must be 0.3010..."); +yield* thread.procedures["Zassert %b %s"]((((Math.log(10) / Math.LN10) || 0) === 1),"log 10 must be 1"); +yield* thread.procedures["Zassert %b %s"]((((Math.log(100) / Math.LN10) || 0) === 2),"log 100 must be 2"); +yield* thread.procedures["Zassert %b %s"]((Math.exp(1) === 2.718281828459045),"e ^ 1 must be 2.718281828459045"); +yield* thread.procedures["Zassert %b %s"]((Math.exp(0) === 1),"e ^ 0 must be 1"); +yield* thread.procedures["Zassert %b %s"](((10 ** 1) === 10),"10 ^ 1 must be 10"); +yield* thread.procedures["Zassert %b %s"](((10 ** 0) === 1),"10 ^ 0 must be 1"); +yield* thread.procedures["Zassert %b %s"](((10 ** 2) === 100),"10 ^ 2 must be 100"); +yield* thread.procedures["Zassert %b %s"](((+(0 === 50)) === (+(0 === 50))),"real false = real false"); +yield* thread.procedures["Zassert %b %s"](((+("".toLowerCase() === "".toLowerCase())) === (+("".toLowerCase() === "".toLowerCase()))),"real true = real true"); +yield* thread.procedures["Zassert %b %s"](("true".toLowerCase() === ("" + ("".toLowerCase() === "".toLowerCase())).toLowerCase()),"string true = real true"); +yield* thread.procedures["Zassert %b %s"](("false".toLowerCase() === ("" + (0 === 50)).toLowerCase()),"string false = real false"); +yield* thread.procedures["Zassert %b %s"]((("" + ("".toLowerCase() === "".toLowerCase())).toLowerCase() === "true".toLowerCase()),"real true = string true"); +yield* thread.procedures["Zassert %b %s"]((("" + (0 === 50)).toLowerCase() === "false".toLowerCase()),"real false = string false"); +yield* thread.procedures["Zassert %b %s"](((+(0 === 1)) === 0),"real false = string 0"); +yield* thread.procedures["Zassert %b %s"](((+(0 === 0)) === 1),"real true = string 1"); +yield* thread.procedures["Zassert %b %s"](compareEqual((0 === 1), (0 + 0)),"real false = number 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual((0 === 0), (1 + 0)),"real true = number 1"); +yield* thread.procedures["Zassert %b %s"](((((+("0x" + "12f3") || 0) + 0) || 0) === 4851),"positive hex"); +yield* thread.procedures["Zassert %b %s"](((((+("0o" + "127") || 0) + 0) || 0) === 87),"positive octal"); +yield* thread.procedures["Zassert %b %s"](((((+("0b" + "1010101") || 0) + 0) || 0) === 85),"positive binary"); +yield* thread.procedures["Zassert %b %s"](compareEqual(((+("-0x" + "123") || 0) + 0), 0),"negative hex is 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual(((+("-0o" + "123") || 0) + 0), 0),"negative octal is 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual(((+("-0b" + "10101") || 0) + 0), 0),"negative binary is 0"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * 57.7) / 180) * 1e10) / 1e10) || 0) === 0.8452618332),"sin 57.7"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.sin((Math.PI * 0) / 180) * 1e10) / 1e10), 0),"sin 0"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * 90) / 180) * 1e10) / 1e10) || 0) === 1),"sin 90"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.sin((Math.PI * 180) / 180) * 1e10) / 1e10), 0),"sin 180"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * 270) / 180) * 1e10) / 1e10) || 0) === -1),"sin 270"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.sin((Math.PI * 360) / 180) * 1e10) / 1e10), 0),"sin 360"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * 450) / 180) * 1e10) / 1e10) || 0) === 1),"sin 450"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * -90) / 180) * 1e10) / 1e10) || 0) === -1),"sin -90"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.sin((Math.PI * -180) / 180) * 1e10) / 1e10), 0),"sin -180"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * -270) / 180) * 1e10) / 1e10) || 0) === 1),"sin -270"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.sin((Math.PI * -360) / 180) * 1e10) / 1e10), 0),"sin -360"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.sin((Math.PI * -450) / 180) * 1e10) / 1e10) || 0) === -1),"sin -450"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * 57.7) / 180) * 1e10) / 1e10) || 0) === 0.5343523494),"cos 57.7"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * 0) / 180) * 1e10) / 1e10) || 0) === 1),"cos 0"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * 90) / 180) * 1e10) / 1e10), 0),"cos 90"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * 180) / 180) * 1e10) / 1e10) || 0) === -1),"cos 180"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * 270) / 180) * 1e10) / 1e10), 0),"cos 270"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * 360) / 180) * 1e10) / 1e10) || 0) === 1),"cos 360"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * 450) / 180) * 1e10) / 1e10), 0),"cos 450"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * -90) / 180) * 1e10) / 1e10), 0),"cos -90"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * -180) / 180) * 1e10) / 1e10) || 0) === -1),"cos -180"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * -270) / 180) * 1e10) / 1e10), 0),"cos -270"); +yield* thread.procedures["Zassert %b %s"]((((Math.round(Math.cos((Math.PI * -360) / 180) * 1e10) / 1e10) || 0) === 1),"cos -360"); +yield* thread.procedures["Zassert %b %s"](compareEqual((Math.round(Math.cos((Math.PI * -450) / 180) * 1e10) / 1e10), 0),"cos -450"); +yield* thread.procedures["ZOKAY"](); +retire(); return; +}; }) + +// Sprite1 Zassert %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assert__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 ZOKAY +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OKAY () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "cL", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + "0"),}, b0, false, false, "aX", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "cM", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "a!", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + "0"),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "a%", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-preserve-order-after-stop-other-scripts.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-preserve-order-after-stop-other-scripts.sb3.tw-snapshot new file mode 100644 index 00000000000..d5352099960 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-preserve-order-after-stop-other-scripts.sb3.tw-snapshot @@ -0,0 +1,81 @@ +// TW Snapshot +// Input SHA-256: 33ae042ed2e2affa758cf695de33f44b075e96d01ccb919972d262517492f6fc + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["C7VGwqE9rvJgpw(oV^?E"]; +return function* genXYZ () { +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "3" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "2" }); +runtime.stopForTarget(target, thread); +b0.value = []; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "2" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "3" }); +thread.timer = timer(); +var a0 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a0) { +yield; +} +thread.timer = null; +if (((+listContents(b0) || 0) === 312)) { +yield* thread.procedures["ZOK %s"](""); +} else { +yield* thread.procedures["ZFAIL %s"](""); +} +retire(); return; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "d", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "b", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "f", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "h", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "c", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "j", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["C7VGwqE9rvJgpw(oV^?E"]; +return function* genXYZ () { +b0.value.push(1); +b0._monitorUpToDate = false; +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["C7VGwqE9rvJgpw(oV^?E"]; +return function* genXYZ () { +b0.value.push(2); +b0._monitorUpToDate = false; +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["C7VGwqE9rvJgpw(oV^?E"]; +return function* genXYZ () { +b0.value.push(3); +b0._monitorUpToDate = false; +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-procedure-definition-order.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-procedure-definition-order.sb3.tw-snapshot new file mode 100644 index 00000000000..63d4e6deecd --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-procedure-definition-order.sb3.tw-snapshot @@ -0,0 +1,28 @@ +// TW Snapshot +// Input SHA-256: 2979239837a20f2d91405b400ec98101ec8262f2e0b89b0f0204591c9dd9c25d + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["ZA"](); +retire(); return; +}; }) + +// Sprite1 ZA +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_A () { +yield* thread.procedures["ZOK %s"](""); +return ""; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "c", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "a", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "e", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-run-blocks-after-self-broadcast.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-run-blocks-after-self-broadcast.sb3.tw-snapshot new file mode 100644 index 00000000000..24dc9e4c3d5 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-run-blocks-after-self-broadcast.sb3.tw-snapshot @@ -0,0 +1,56 @@ +// TW Snapshot +// Input SHA-256: 9902bbdd6b9a5d5c25b5382a533e1b3a72ea1f5ca68709abf08a9e6af339f2c7 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables[")Vp94b3HO|$4At]V7XiJ"]; +const b1 = stage.variables["`NuUx`@:w=|8`D7S4l-t"]; +return function* genXYZ () { +b0.value = 0; +b1.value = 0; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables[")Vp94b3HO|$4At]V7XiJ"]; +const b1 = stage.variables["`NuUx`@:w=|8`D7S4l-t"]; +return function* genXYZ () { +if (compareEqual(b0.value, 0)) { +b0.value = 1; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +b1.value = 1; +} else { +if (((+b1.value || 0) === 1)) { +yield* thread.procedures["ZOK %s"](""); +} else { +yield* thread.procedures["ZFAIL %s"](""); +} +} +retire(); return; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "i", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "d", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "k", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "e", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "c", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "g", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-scripts-run-after-stop-all.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-scripts-run-after-stop-all.sb3.tw-snapshot new file mode 100644 index 00000000000..8a3a1131c49 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-scripts-run-after-stop-all.sb3.tw-snapshot @@ -0,0 +1,93 @@ +// TW Snapshot +// Input SHA-256: 53f9471a2e476b366db519bae1d739833c0210dd92ca501a29a3dfce9a1f960d + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "3loop" }); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["5*)/o6gQzEw)31Ah!j:j"]; +const b1 = stage.variables["sYUvu8`..xuGcWX3!B1k"]; +return function* genXYZ () { +while (!compareGreaterThan(b0.value, 2)) { +b0.value = ((+b0.value || 0) + 1); +yield; +} +if (((+b1.value || 0) === 1)) { +yield* thread.procedures["ZOK %s"](""); +} else { +if (compareEqual(b1.value, 0)) { +yield* thread.procedures["ZFAIL %s"]("variable 1 haven't been incremented"); +} else { +yield* thread.procedures["ZFAIL %s"]("variable 1 got incremented multiple times"); +} +} +retire(); return; +}; }) + +// Sprite1 ZOK %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OK_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "f", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + ("" + p0)),}, b0, false, false, "d", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "j", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + ("" + p0)),}, b0, false, false, "e", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["sYUvu8`..xuGcWX3!B1k"]; +const b1 = stage.variables["5*)/o6gQzEw)31Ah!j:j"]; +return function* genXYZ () { +b0.value = 0; +b1.value = 0; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "2" }); +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "3" }); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +runtime.stopAll(); +retire(); return; +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "1loop" }); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["sYUvu8`..xuGcWX3!B1k"]; +return function* genXYZ () { +while (true) { +b0.value = ((+b0.value || 0) + 1); +yield; +} +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-stop-other-scripts-in-sprite.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-stop-other-scripts-in-sprite.sb3.tw-snapshot new file mode 100644 index 00000000000..e447f4aa379 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-stop-other-scripts-in-sprite.sb3.tw-snapshot @@ -0,0 +1,36 @@ +// TW Snapshot +// Input SHA-256: 1d077dfdf08990f391b64e59cc3b31530abe3b2aef12e54678743a1f74f99ae5 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "b", null); +b1.value = 0; +startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }); +runtime.stopForTarget(target, thread); +thread.timer = timer(); +var a0 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a0) { +yield; +} +thread.timer = null; +if (compareEqual(b1.value, 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "k", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, "m", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "j", null); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +return function* genXYZ () { +b0.value = ((+b0.value || 0) + 1); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-string-functions.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-string-functions.sb3.tw-snapshot new file mode 100644 index 00000000000..155a3616491 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-string-functions.sb3.tw-snapshot @@ -0,0 +1,282 @@ +// TW Snapshot +// Input SHA-256: 0d7c7d4a267a29ff249f9314e87a7a7170870dc48175ffdba5a12fa48e8ba0a2 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ () { +yield* thread.procedures["Ztest endsWith"](); +yield* thread.procedures["Ztest startsWith"](); +yield* thread.procedures["Ztest includes"](); +yield* thread.procedures["Ztest indexOf"](); +yield* thread.procedures["Ztest replace"](); +yield* thread.procedures["ZOKAY %s"]((("" + runtime.ioDevices.clock.projectTimer()) + " seconds")); +retire(); return; +}; }) + +// Sprite1 Ztest endsWith +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ_test_endsWith () { +yield* thread.procedures["W%s .endsWith( %s )"](12333,333); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must end with 333"); +yield* thread.procedures["W%s .endsWith( %s )"](12333,33); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must end with 33"); +yield* thread.procedures["W%s .endsWith( %s )"](12333,""); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must end with empty string"); +yield* thread.procedures["W%s .endsWith( %s )"](12333,4); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "false".toLowerCase()),"12333 must not end with 4"); +yield* thread.procedures["W%s .endsWith( %s )"](12333,123334); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "false".toLowerCase()),"12333 must not end with 123334"); +yield* thread.procedures["W%s .endsWith( %s )"](12333,12333); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must end with itself"); +yield* thread.procedures["W%s .includes( %s )"]("abc",""); +return ""; +}; }) + +// Sprite1 Ztest startsWith +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ_test_startsWith () { +yield* thread.procedures["W%s .startsWith( %s )"](12333,12333); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with 12333"); +yield* thread.procedures["W%s .startsWith( %s )"](12333,1233); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with 1233"); +yield* thread.procedures["W%s .startsWith( %s )"](12333,123); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with 123"); +yield* thread.procedures["W%s .startsWith( %s )"](12333,12); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with 12"); +yield* thread.procedures["W%s .startsWith( %s )"](12333,1); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with 1"); +yield* thread.procedures["W%s .startsWith( %s )"](12333,""); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"12333 must start with empty string"); +yield* thread.procedures["W%s .startsWith( %s )"](12333,33); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "false".toLowerCase()),"12333 must not start with 33"); +return ""; +}; }) + +// Sprite1 Ztest includes +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ_test_includes () { +yield* thread.procedures["W%s .includes( %s )"]("abc",""); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include empty string"); +yield* thread.procedures["W%s .includes( %s )"]("",""); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"empty string must include empty string"); +yield* thread.procedures["W%s .includes( %s )"]("abc","abc"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include abc"); +yield* thread.procedures["W%s .includes( %s )"]("abc","a"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include a"); +yield* thread.procedures["W%s .includes( %s )"]("abc","b"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include b"); +yield* thread.procedures["W%s .includes( %s )"]("abc","c"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include c"); +yield* thread.procedures["W%s .includes( %s )"]("abc","ab"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include ab"); +yield* thread.procedures["W%s .includes( %s )"]("abc","bc"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "true".toLowerCase()),"abc must include bc"); +yield* thread.procedures["W%s .includes( %s )"]("abc","aa"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "false".toLowerCase()),"abc must not include aa"); +return ""; +}; }) + +// Sprite1 Ztest indexOf +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ_test_indexOf () { +yield* thread.procedures["W%s .indexOf( %s )"](123,1); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === 1),"index of 1 in 123 is 1"); +yield* thread.procedures["W%s .indexOf( %s )"](123,2); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === 2),"index of 2 in 123 is 2"); +yield* thread.procedures["W%s .indexOf( %s )"](123,3); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === 3),"index of 3 in 123 is 3"); +yield* thread.procedures["W%s .indexOf( %s )"](123,"aaaa"); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === -1),"index of aaaa in 123 is -1"); +return ""; +}; }) + +// Sprite1 Ztest lastIndexOf +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function funXYZ_test_lastIndexOf () { +return ""; +}; }) + +// Sprite1 Ztest replace +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ_test_replace () { +yield* thread.procedures["W%s .replace( %s with %s )"](123456,345,"a"); +yield* thread.procedures["Zassert %b %s"]((("" + b0.value).toLowerCase() === "12a6".toLowerCase()),"replace expected 12a6"); +yield* thread.procedures["W%s .replace( %s with %s )"](123,123,456); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === 456),"replace expected 456"); +yield* thread.procedures["W%s .replace( %s with %s )"](123,1234,456); +yield* thread.procedures["Zassert %b %s"](((+b0.value || 0) === 123),"replace expected 123"); +return ""; +}; }) + +// Sprite1 Ztest split +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function funXYZ_test_split () { +return ""; +}; }) + +// Sprite1 ZOKAY %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_OKAY_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "aq", null); +yield* executeInCompatibilityLayer({"MESSAGE":("pass " + "0"),}, b0, false, false, "C", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "as", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) + +// Sprite1 W%s .endsWith( %s ) +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:bufferl-list"]; +const b1 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:iterator-"]; +const b2 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ___endsWith____ (p0,p1) { +b0.value = []; +b1.value = ("" + p0).length; +for (var a0 = ("" + p1).length; a0 > 0; a0--) { +b0.value.unshift(((("" + p0))[((+b1.value) | 0) - 1] || "")); +b0._monitorUpToDate = false; +b1.value = ((+b1.value || 0) + -1); +if (isStuck()) yield; +} +b2.value = compareEqual(listContents(b0), p1); +return ""; +}; }) + +// Sprite1 Zassert %b %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +return function* genXYZ_assert__ (p0,p1) { +if (!toBoolean(p0)) { +yield* thread.procedures["ZFAIL %s"](p1); +} +return ""; +}; }) + +// Sprite1 W%s .includes( %s ) +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +const b1 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:bufferl-list"]; +const b2 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:iterator-"]; +return function* genXYZ___includes____ (p0,p1) { +if ((("" + p1).length === 0)) { +b0.value = "true"; +return ""; +} +b1.value = []; +b0.value = "false"; +b2.value = 0; +for (var a0 = ("" + p0).length; a0 > 0; a0--) { +b2.value = ((+b2.value || 0) + 1); +b1.value.push(((("" + p0))[(b2.value | 0) - 1] || "")); +b1._monitorUpToDate = false; +if ((b1.value.length > ("" + p1).length)) { +b1.value.shift(); +b1._monitorUpToDate = false; +} +if (compareEqual(listContents(b1), p1)) { +b0.value = "true"; +return ""; +} +if (isStuck()) yield; +} +return ""; +}; }) + +// Sprite1 W%s .startsWith( %s ) +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:bufferl-list"]; +const b1 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:iterator-"]; +const b2 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +return function* genXYZ___startsWith____ (p0,p1) { +b0.value = []; +b1.value = 0; +for (var a0 = ("" + p1).length; a0 > 0; a0--) { +b1.value = ((+b1.value || 0) + 1); +b0.value.push(((("" + p0))[(b1.value | 0) - 1] || "")); +b0._monitorUpToDate = false; +if (isStuck()) yield; +} +b2.value = compareEqual(listContents(b0), p1); +return ""; +}; }) + +// Sprite1 W%s .indexOf( %s ) +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:bufferl-list"]; +const b1 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +const b2 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:iterator-"]; +return function* genXYZ___indexOf____ (p0,p1) { +b0.value = []; +b1.value = -1; +b2.value = 0; +for (var a0 = ("" + p0).length; a0 > 0; a0--) { +b2.value = ((+b2.value || 0) + 1); +b0.value.push(((("" + p0))[(b2.value | 0) - 1] || "")); +b0._monitorUpToDate = false; +if ((b0.value.length > ("" + p1).length)) { +b0.value.shift(); +b0._monitorUpToDate = false; +} +if (compareEqual(listContents(b0), p1)) { +b1.value = (b2.value - (("" + p1).length - 1)); +return ""; +} +if (isStuck()) yield; +} +return ""; +}; }) + +// Sprite1 W%s .replace( %s with %s ) +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:bufferl-list"]; +const b1 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:templ-list"]; +const b2 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-@return-"]; +const b3 = stage.variables["aBQ}o|vZt_fHtB~ZyHPZ-sutils:iterator-"]; +return function* genXYZ___replace___with___ (p0,p1,p2) { +b0.value = []; +b1.value = []; +b2.value = ""; +b3.value = 0; +for (var a0 = ("" + p0).length; a0 > 0; a0--) { +b3.value = ((+b3.value || 0) + 1); +b0.value.push(((("" + p0))[(b3.value | 0) - 1] || "")); +b0._monitorUpToDate = false; +if ((b0.value.length > ("" + p1).length)) { +b0.value.shift(); +b0._monitorUpToDate = false; +} +b1.value.push(((("" + p0))[(b3.value | 0) - 1] || "")); +b1._monitorUpToDate = false; +if (compareEqual(listContents(b0), p1)) { +for (var a1 = ("" + p1).length; a1 > 0; a1--) { +b1.value.pop(); +b1._monitorUpToDate = false; +if (isStuck()) yield; +} +b2.value = (("" + b2.value) + listContents(b1)); +b2.value = (("" + b2.value) + ("" + p2)); +b1.value = []; +} +if (isStuck()) yield; +} +b2.value = (("" + b2.value) + listContents(b1)); +return ""; +}; }) + +// Sprite1 ZFAIL %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_FAIL_ (p0) { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "bY", null); +yield* executeInCompatibilityLayer({"MESSAGE":("fail " + "0"),}, b0, false, false, "=", null); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "b!", null); +runtime.stopAll(); +retire(); yield; +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/forkphorus-tangent.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/forkphorus-tangent.sb3.tw-snapshot new file mode 100644 index 00000000000..b2ccf9ce3a3 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/forkphorus-tangent.sb3.tw-snapshot @@ -0,0 +1,56 @@ +// TW Snapshot +// Input SHA-256: 1446684578b41ff41cf29fbe14696ef717cca636e8d46babd7d9dec6df723a33 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 15",}, b0, false, false, "p", null); +if (compareEqual(tan(0), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 0",}, b0, false, false, "O", null); +} +if (((tan(90) || 0) === Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 90",}, b0, false, false, "G", null); +} +if (compareEqual(tan(180), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 180",}, b0, false, false, "I", null); +} +if (((tan(270) || 0) === -Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 270",}, b0, false, false, "K", null); +} +if (compareEqual(tan(360), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 360",}, b0, false, false, "M", null); +} +if (((tan(450) || 0) === Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 450",}, b0, false, false, "Q", null); +} +if (compareEqual(tan(540), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 540",}, b0, false, false, "S", null); +} +if (((tan(630) || 0) === -Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 630",}, b0, false, false, "U", null); +} +if (compareEqual(tan(720), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 720",}, b0, false, false, "W", null); +} +if (((tan(810) || 0) === Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass 810",}, b0, false, false, "Y", null); +} +if (((tan(-90) || 0) === -Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -90",}, b0, false, false, "0", null); +} +if (compareEqual(tan(-180), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -180",}, b0, false, false, "2", null); +} +if (((tan(-270) || 0) === Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -270",}, b0, false, false, "4", null); +} +if (compareEqual(tan(-360), 0)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -360",}, b0, false, false, "6", null); +} +if (((tan(-450) || 0) === -Infinity)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass -450",}, b0, false, false, "9", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "8", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/tw-loop-custom-reporter.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/tw-loop-custom-reporter.sb3.tw-snapshot deleted file mode 100644 index a606d8595fd..00000000000 --- a/test/snapshot/__snapshots__/warp-timer/tw-loop-custom-reporter.sb3.tw-snapshot +++ /dev/null @@ -1,27 +0,0 @@ -// TW Snapshot -// Input SHA-256: 360d8b29e0e690dda9e91faed6881057d1f38d98258ed8e11c75bdd30536b560 - -// Sprite1 script -(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); -const b0 = runtime.getOpcodeFunction("looks_say"); -const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; -return function* genXYZ () { -yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, null, null); -b1.value = 0; -for (var a0 = (+thread.procedures["Zblock name"]() || 0); a0 >= 0.5; a0--) { -b1.value = ((+b1.value || 0) + 1); -yield; -} -if (((+b1.value || 0) === 4)) { -yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null, null); -} -yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null, null); -retire(); return; -}; }) - -// Sprite1 block name -(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); -return function funXYZ_block_name () { -return 4; -return ""; -}; })