Merge pull request #96 from TurboWarp/snapshot-testing
Implement compiler output snapshot testing
This commit is contained in:
40 files changed
+3323
No files matched your search
@@ -0,0 +1,83 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Sprite2 script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["p]KODv+)+:l=%NT~j3/d-order"];
|
||||
const b1 = stage.variables["p]KODv+)+:l=%NT~j3/d-wait"];
|
||||
const b2 = runtime.getOpcodeFunction("looks_say");
|
||||
return function* genXYZ () {
|
||||
b0.value = 0;
|
||||
thread.timer = timer();
|
||||
var a0 = Math.max(0, 1000 * (+b1.value || 0));
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a0) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
b0.value = ((+b0.value || 0) + 1);
|
||||
if (((b0.value || 0) === 1)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass order is correct (1)",}, b2, false, false, null);
|
||||
} else {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":("fail order is incorrect 1 != " + ("" + b0.value)),}, b2, false, false, null);
|
||||
}
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite3 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["p]KODv+)+:l=%NT~j3/d-wait"];
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 2",}, b0, false, false, null);
|
||||
thread.timer = timer();
|
||||
var a0 = Math.max(0, 1000 * (+b1.value || 0));
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a0) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
thread.timer = timer();
|
||||
var a1 = Math.max(0, 1000 * (+b1.value || 0));
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a1) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
thread.timer = timer();
|
||||
var a2 = Math.max(0, 1000 * (+b1.value || 0));
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a2) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite1 script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["p]KODv+)+:l=%NT~j3/d-order"];
|
||||
const b1 = stage.variables["p]KODv+)+:l=%NT~j3/d-wait"];
|
||||
const b2 = runtime.getOpcodeFunction("looks_say");
|
||||
return function* genXYZ () {
|
||||
b0.value = 0;
|
||||
thread.timer = timer();
|
||||
var a0 = Math.max(0, 1000 * (+b1.value || 0));
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a0) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
b0.value = ((+b0.value || 0) + 1);
|
||||
if (((b0.value || 0) === 2)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass order is correct (2)",}, b2, false, false, null);
|
||||
} else {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":("fail order is incorrect 2 != " + ("" + b0.value)),}, b2, false, false, null);
|
||||
}
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,83 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Sprite3 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["):/PVGTvoVRvq(ikGwRE-wait"];
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 2",}, b0, false, false, null);
|
||||
thread.timer = timer();
|
||||
var a0 = Math.max(0, 1000 * (+b1.value || 0));
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a0) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
thread.timer = timer();
|
||||
var a1 = Math.max(0, 1000 * (+b1.value || 0));
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a1) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
thread.timer = timer();
|
||||
var a2 = Math.max(0, 1000 * (+b1.value || 0));
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a2) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite1 script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["):/PVGTvoVRvq(ikGwRE-order"];
|
||||
const b1 = stage.variables["):/PVGTvoVRvq(ikGwRE-wait"];
|
||||
const b2 = runtime.getOpcodeFunction("looks_say");
|
||||
return function* genXYZ () {
|
||||
b0.value = 0;
|
||||
thread.timer = timer();
|
||||
var a0 = Math.max(0, 1000 * (+b1.value || 0));
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a0) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
b0.value = ((+b0.value || 0) + 1);
|
||||
if (((b0.value || 0) === 1)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass order is correct (1)",}, b2, false, false, null);
|
||||
} else {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":("fail order is incorrect 1 != " + ("" + b0.value)),}, b2, false, false, null);
|
||||
}
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite2 script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["):/PVGTvoVRvq(ikGwRE-order"];
|
||||
const b1 = stage.variables["):/PVGTvoVRvq(ikGwRE-wait"];
|
||||
const b2 = runtime.getOpcodeFunction("looks_say");
|
||||
return function* genXYZ () {
|
||||
b0.value = 0;
|
||||
thread.timer = timer();
|
||||
var a0 = Math.max(0, 1000 * (+b1.value || 0));
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a0) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
b0.value = ((+b0.value || 0) + 1);
|
||||
if (((b0.value || 0) === 2)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass order is correct (2)",}, b2, false, false, null);
|
||||
} else {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":("fail order is incorrect 2 != " + ("" + b0.value)),}, b2, false, false, null);
|
||||
}
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,58 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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 16",}, b0, false, false, null);
|
||||
if ((("" + (0 * Infinity)).toLowerCase() === "NaN".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual((((0 * Infinity) || 0) * 1), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + ((Math.acos(1.01) * 180) / Math.PI)).toLowerCase() === "NaN".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(((((Math.acos(1.01) * 180) / Math.PI) || 0) * 1), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + ((Math.asin(1.01) * 180) / Math.PI)).toLowerCase() === "NaN".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(((((Math.asin(1.01) * 180) / Math.PI) || 0) * 1), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + (0 / 0)).toLowerCase() === "NaN".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual((((0 / 0) || 0) * 1), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + Math.sqrt(-1)).toLowerCase() === "NaN".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(((Math.sqrt(-1) || 0) * 1), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + mod(0, 0)).toLowerCase() === "NaN".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(((mod(0, 0) || 0) * 1), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + Math.log(-1)).toLowerCase() === "NaN".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(((Math.log(-1) || 0) * 1), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + (Math.log(-1) / Math.LN10)).toLowerCase() === "NaN".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual((((Math.log(-1) / Math.LN10) || 0) * 1), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,13 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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, null);
|
||||
if (!((Infinity + -Infinity) <= 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,13 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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, null);
|
||||
if (true) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,19 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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":"pass",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// 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, null);
|
||||
yield* waitThreads(startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" }));
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,21 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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);
|
||||
target.setSize(96);
|
||||
b1.value = 0;
|
||||
while (!(100 === Math.round(target.size))) {
|
||||
b1.value = ((+b1.value || 0) + 1);
|
||||
target.setSize(target.size + ((((100 - Math.round(target.size)) || 0) / 10) || 0));
|
||||
yield;
|
||||
}
|
||||
if (((+b1.value || 0) === 20)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,15 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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);
|
||||
b1.value = "#22388a";
|
||||
if ((("" + b1.value).toLowerCase() === "#22388a".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,128 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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 0",}, b0, false, false, null);
|
||||
yield* thread.procedures["Wrun test"]();
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite1 run test
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["mfV;yS}9e:%h5UZ)QyiY"];
|
||||
const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"];
|
||||
const b2 = stage.variables["n^wm8jw#b24sggt.S^tD"];
|
||||
const b3 = stage.variables["_]6^lq+-%H0{ov`tKt7$"];
|
||||
const b4 = stage.variables["3lyKRepBc$tx)EWlpr!y"];
|
||||
const b5 = runtime.getOpcodeFunction("looks_say");
|
||||
return function* genXYZ_run_test () {
|
||||
thread.procedures["Wsetup values"]();
|
||||
b0.value = 0;
|
||||
b1.value = 0;
|
||||
for (var a0 = b2.value.length; a0 >= 0.5; a0--) {
|
||||
b1.value = ((+b1.value || 0) + 1);
|
||||
b3.value = 0;
|
||||
for (var a1 = b2.value.length; a1 >= 0.5; a1--) {
|
||||
b3.value = ((+b3.value || 0) + 1);
|
||||
b0.value = ((+b0.value || 0) + 1);
|
||||
if (!compareEqual(compareGreaterThan(listGet(b2.value, b1.value), (b2.value[((b3.value || 0) | 0) - 1] ?? "")), (b4.value[((b0.value || 0) | 0) - 1] ?? ""))) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":("fail " + (("" + listGet(b2.value, b1.value)) + (" should be > " + ("" + listGet(b2.value, b3.value))))),}, b5, true, false, null);
|
||||
}
|
||||
b0.value = ((+b0.value || 0) + 1);
|
||||
if (!compareEqual(compareEqual(listGet(b2.value, b1.value), listGet(b2.value, b3.value)), (b4.value[((b0.value || 0) | 0) - 1] ?? ""))) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":("fail " + (("" + listGet(b2.value, b1.value)) + (" should be = " + ("" + listGet(b2.value, b3.value))))),}, b5, true, false, null);
|
||||
}
|
||||
b0.value = ((+b0.value || 0) + 1);
|
||||
if (!compareEqual(compareLessThan(listGet(b2.value, b1.value), listGet(b2.value, b3.value)), (b4.value[((b0.value || 0) | 0) - 1] ?? ""))) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":("fail " + (("" + listGet(b2.value, b1.value)) + (" should be < " + ("" + listGet(b2.value, b3.value))))),}, b5, true, true, null);
|
||||
if (hasResumedFromPromise) {hasResumedFromPromise = false;continue;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}; })
|
||||
|
||||
// Sprite1 setup values
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["n^wm8jw#b24sggt.S^tD"];
|
||||
return function funXYZ_setup_values () {
|
||||
b0.value = [];
|
||||
b0.value.push(0);
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(1);
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(2);
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(-1);
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(-2);
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("0.0");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("-0.");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("-0.0");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(".123");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("-.123");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("1.");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((0 + 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((1 + 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((2 + 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((-1 + 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((-2 + 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((0.123 + 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((-0.123 + 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((1 + 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("1e99");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((1e+99 + 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(Infinity);
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(-Infinity);
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("-infinitY");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((1 / 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((-1 / 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push((0 / 0));
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(NaN);
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("nan");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("-NaN");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("true");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("false");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(!false);
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(!!false);
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("Banana");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push(" ");
|
||||
b0._monitorUpToDate = false;
|
||||
b0.value.push("🎉");
|
||||
b0._monitorUpToDate = false;
|
||||
}; })
|
||||
@@ -0,0 +1,35 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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.getSpriteTargetByName("Sprite1");
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 6",}, b0, false, false, null);
|
||||
target.setXY(1e-9, target.y);
|
||||
if ((limitPrecision(target.x) === 1e-9)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass much above x does not round",}, b0, false, false, null);
|
||||
}
|
||||
if (((b1 ? b1.x : 0) === 1e-9)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass initial 'of' test",}, b0, false, false, null);
|
||||
}
|
||||
target.setXY(target.x + 0, target.y);
|
||||
runtime.ext_scratch3_motion._moveSteps(0, target);
|
||||
target.setXY(target.x + -9e-10, target.y);
|
||||
if (((b1 ? b1.x : 0) === 1.0000000000000007e-10)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 'of' never rounds - positive x",}, b0, false, false, null);
|
||||
}
|
||||
if ((limitPrecision(target.x) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass x slightly above 0 rounds",}, b0, false, false, null);
|
||||
}
|
||||
target.setXY(target.x + -9e-10, target.y);
|
||||
target.setXY(target.x, target.y + 0);
|
||||
if (((b1 ? b1.x : 0) === -7.999999999999999e-10)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 'of' never rounds and change x - negative x",}, b0, false, false, null);
|
||||
}
|
||||
if ((limitPrecision(target.x) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass x slightly below 0 rounds",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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 4",}, b0, false, false, null);
|
||||
if (compareGreaterThan(("something".toLowerCase() === "something".toLowerCase()), ("0" + ""))) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareLessThan(("something".toLowerCase() === "else".toLowerCase()), ("1" + ""))) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareGreaterThan(("something".toLowerCase() === "something".toLowerCase()), (0 + 0))) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareLessThan(("something".toLowerCase() === "else".toLowerCase()), (1 + 0))) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,27 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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_pointtowards");
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 4",}, b0, false, false, null);
|
||||
target.setDirection(95);
|
||||
if ((target.direction === 95)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 1",}, b0, false, false, null);
|
||||
}
|
||||
target.setDirection(((1 / 0) || 0));
|
||||
if ((target.direction === 95)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 2",}, b0, false, false, null);
|
||||
}
|
||||
target.setDirection(((0 / 0) || 0));
|
||||
if ((target.direction === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 3",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"TOWARDS":"Sprite2",}, b1, false, false, null);
|
||||
if ((target.direction === 90)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 4",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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 6",}, b0, false, false, null);
|
||||
b1.value = runtime.ext_scratch3_operators._random(("an invalid number" + "."), 1);
|
||||
if ((b1.value > 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareLessThan(b1.value, 1)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + b1.value).toLowerCase().indexOf(".".toLowerCase()) !== -1)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
b1.value = runtime.ext_scratch3_operators._random(1, ("an invalid number" + "."));
|
||||
if ((b1.value > 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareLessThan(b1.value, 1)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + b1.value).toLowerCase().indexOf(".".toLowerCase()) !== -1)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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 = target.variables["gTtSj;o_E;Snkn620KF."];
|
||||
const b2 = target.variables["zShM`!CD?d_|Z,]5X}N6"];
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 2",}, b0, false, false, null);
|
||||
b1.value = 2;
|
||||
if (((+b1.value || 0) === 2)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass variable",}, b0, false, false, null);
|
||||
}
|
||||
b2.value = [];
|
||||
b2.value.push(3);
|
||||
b2._monitorUpToDate = false;
|
||||
if (((+(b2.value[(1 | 0) - 1] ?? "") || 0) === 3)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass list",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Sprite1 script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = runtime.getOpcodeFunction("sound_setvolumeto");
|
||||
const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"];
|
||||
const b2 = runtime.getOpcodeFunction("looks_say");
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"VOLUME":0,}, b0, false, false, null);
|
||||
b1.value = 0;
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b2, false, false, null);
|
||||
yield* thread.procedures["Wno refresh"]();
|
||||
yield* thread.procedures["Wruns below with no refresh"]();
|
||||
if (compareEqual(b1.value, 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b2, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b2, false, false, null);
|
||||
runtime.stopAll();
|
||||
retire(); return;
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite1 no refresh
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = runtime.getOpcodeFunction("music_restForBeats");
|
||||
const b1 = runtime.getOpcodeFunction("music_playDrumForBeats");
|
||||
return function* genXYZ_no_refresh () {
|
||||
for (var a0 = 30; a0 >= 0.5; a0--) {
|
||||
thread.timer = timer();
|
||||
var a1 = Math.max(0, 1000 * 0);
|
||||
runtime.requestRedraw();
|
||||
while (thread.timer.timeElapsed() < a1) {
|
||||
if (isStuck()) yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
yield* executeInCompatibilityLayer({"BEATS":0,}, b0, true, false, null);
|
||||
yield* executeInCompatibilityLayer({"DRUM":1,"BEATS":0,}, b1, true, false, null);
|
||||
runtime.ext_scratch3_motion._moveSteps(0, target);
|
||||
}
|
||||
}; })
|
||||
|
||||
// Sprite1 runs below with no refresh
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
return function* genXYZ_runs_below_with_no_r () {
|
||||
yield* thread.procedures["Whas refresh"]();
|
||||
}; })
|
||||
|
||||
// Sprite1 has refresh
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = runtime.getOpcodeFunction("music_restForBeats");
|
||||
const b1 = runtime.getOpcodeFunction("music_playDrumForBeats");
|
||||
return function* genXYZ_has_refresh () {
|
||||
for (var a0 = 30; a0 >= 0.5; a0--) {
|
||||
thread.timer = timer();
|
||||
var a1 = Math.max(0, 1000 * 0);
|
||||
runtime.requestRedraw();
|
||||
while (thread.timer.timeElapsed() < a1) {
|
||||
if (isStuck()) yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
yield* executeInCompatibilityLayer({"BEATS":0,}, b0, true, false, null);
|
||||
yield* executeInCompatibilityLayer({"DRUM":1,"BEATS":0,}, b1, true, false, null);
|
||||
runtime.ext_scratch3_motion._moveSteps(0, target);
|
||||
}
|
||||
}; })
|
||||
|
||||
// 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 () {
|
||||
while (true) {
|
||||
b0.value = ((+b0.value || 0) + 1);
|
||||
yield;
|
||||
}
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,37 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Sprite2 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["eFlmP1{XC+I1:h0Yln.K"];
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 7",}, b0, false, false, null);
|
||||
b1.value = [];
|
||||
listInsert(b1, "any", "a");
|
||||
listInsert(b1, "any", "b");
|
||||
listInsert(b1, "any", "c");
|
||||
if ((b1.value.length === 3)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (listContains(b1, "a")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (listContains(b1, "b")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (listContains(b1, "c")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (listContains(b1, listGet(b1.value, "any"))) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
listDelete(b1, "any");
|
||||
if ((b1.value.length === 2)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(listGet(b1.value, "*"), "")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,32 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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"];
|
||||
const b2 = runtime.getOpcodeFunction("sensing_userid");
|
||||
const b3 = runtime.getOpcodeFunction("motion_xscroll");
|
||||
const b4 = runtime.getOpcodeFunction("motion_yscroll");
|
||||
const b5 = runtime.getOpcodeFunction("motion_scroll_right");
|
||||
const b6 = runtime.getOpcodeFunction("motion_scroll_up");
|
||||
const b7 = runtime.getOpcodeFunction("motion_align_scene");
|
||||
const b8 = runtime.getOpcodeFunction("looks_setstretchto");
|
||||
const b9 = runtime.getOpcodeFunction("looks_changestretchby");
|
||||
const b10 = runtime.getOpcodeFunction("looks_hideallsprites");
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, null);
|
||||
b1.value = (yield* executeInCompatibilityLayer({}, b2, false, false, null));
|
||||
b1.value = (yield* executeInCompatibilityLayer({}, b3, false, false, null));
|
||||
b1.value = (yield* executeInCompatibilityLayer({}, b4, false, false, null));
|
||||
yield* executeInCompatibilityLayer({"DISTANCE":10,}, b5, false, false, null);
|
||||
yield* executeInCompatibilityLayer({"DISTANCE":10,}, b6, false, false, null);
|
||||
yield* executeInCompatibilityLayer({"ALIGNMENT":"bottom-left",}, b7, false, false, null);
|
||||
yield* executeInCompatibilityLayer({"STRETCH":100,}, b8, false, false, null);
|
||||
yield* executeInCompatibilityLayer({"STRETCH":100,}, b8, false, false, null);
|
||||
yield* executeInCompatibilityLayer({"CHANGE":10,}, b9, false, false, null);
|
||||
yield* executeInCompatibilityLayer({"CHANGE":10,}, b9, false, false, null);
|
||||
yield* executeInCompatibilityLayer({}, b10, false, false, null);
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,13 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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, null);
|
||||
if ((((1 / -0) || 0) === -Infinity)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,26 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Sprite1 script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["PsY$$vp$IVH;dDAr[q2h"];
|
||||
const b1 = runtime.getOpcodeFunction("looks_say");
|
||||
const b2 = stage.variables["l^q!%fq]Bv;72dlGf}^Z"];
|
||||
return function* genXYZ () {
|
||||
b0.value = 0;
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 0",}, b1, false, false, null);
|
||||
for (var a0 = 30; a0 >= 0.5; a0--) {
|
||||
b2.value = runtime.ioDevices.clock.projectTimer();
|
||||
thread.timer = timer();
|
||||
var a1 = Math.max(0, 1000 * 0);
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a1) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
yield;
|
||||
}
|
||||
b0.value = 1;
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b1, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Player 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, null);
|
||||
yield* thread.procedures["ZSet Costume"]();
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Player Set Costume
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = runtime.getOpcodeFunction("looks_say");
|
||||
return function* genXYZ_Set_Costume () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}; })
|
||||
@@ -0,0 +1,30 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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 2",}, b0, false, false, null);
|
||||
yield* thread.procedures["Znumber or text %s %s"]("bad","ok");
|
||||
yield* thread.procedures["Zboolean %b %b"]("false",!false);
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite1 number or text %s %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_number_or_text__ (p0,p1) {
|
||||
if ((("" + p1).toLowerCase() === "ok".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
}; })
|
||||
|
||||
// Sprite1 boolean %b %b
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = runtime.getOpcodeFunction("looks_say");
|
||||
return function* genXYZ_boolean__ (p0,p1) {
|
||||
if (toBoolean(p1)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
}; })
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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);
|
||||
b1.value = "";
|
||||
thread.procedures["Zdo something"]();
|
||||
if (!compareEqual(b1.value, "")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite1 do something
|
||||
(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 funXYZ_do_something () {
|
||||
b0.value = "help";
|
||||
}; })
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Apple 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 0",}, b0, false, false, null);
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,51 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Sprite1 script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["JbF5exWEi*m?-UEmkASS"];
|
||||
const b1 = stage.variables["[G/@.KGc-4y[(GZ(bt7o"];
|
||||
const b2 = runtime.getOpcodeFunction("looks_say");
|
||||
const b3 = runtime.getOpcodeFunction("sound_seteffectto");
|
||||
return function* genXYZ () {
|
||||
while (true) {
|
||||
if (compareEqual(b0.value, b1.value)) {
|
||||
} else {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b2, false, false, null);
|
||||
b1.value = b0.value;
|
||||
yield* executeInCompatibilityLayer({"VALUE":b0.value,"EFFECT":"pitch",}, b3, false, true, null);
|
||||
if (hasResumedFromPromise) {hasResumedFromPromise = false;continue;}
|
||||
}
|
||||
yield;
|
||||
}
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite1 script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["[G/@.KGc-4y[(GZ(bt7o"];
|
||||
const b1 = runtime.getOpcodeFunction("looks_say");
|
||||
const b2 = stage.variables["JbF5exWEi*m?-UEmkASS"];
|
||||
return function* genXYZ () {
|
||||
b0.value = 0;
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 15",}, b1, false, false, null);
|
||||
for (var a0 = 15; a0 >= 0.5; a0--) {
|
||||
if (((+b2.value || 0) === 200)) {
|
||||
b2.value = 50;
|
||||
} else {
|
||||
b2.value = 200;
|
||||
}
|
||||
thread.timer = timer();
|
||||
var a1 = Math.max(0, 1000 * 0);
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a1) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
yield;
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b1, false, false, null);
|
||||
runtime.stopAll();
|
||||
retire(); return;
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,33 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Sprite2 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);
|
||||
b1.value = 0;
|
||||
startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" });
|
||||
startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "message1" });
|
||||
thread.timer = timer();
|
||||
var a0 = Math.max(0, 1000 * 0);
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a0) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
if (((+b1.value || 0) === 1)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite2 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();
|
||||
}; })
|
||||
@@ -0,0 +1,24 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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 2",}, b0, false, false, null);
|
||||
thread.procedures["Zswitch %s"]("1");
|
||||
if ((((target.currentCostume + 1) === 2) && ((+target.getCostumes()[target.currentCostume].name || 0) === 1))) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
thread.procedures["Zswitch %s"]("2");
|
||||
if ((((target.currentCostume + 1) === 1) && ((+target.getCostumes()[target.currentCostume].name || 0) === 2))) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite1 switch %s
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
return function funXYZ_switch_ (p0) {
|
||||
runtime.ext_scratch3_looks._setCostume(target, p0);
|
||||
}; })
|
||||
@@ -0,0 +1,113 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Sprite2 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 && stage.lookupVariableByNameAndType("Stage variable", "", true);
|
||||
const b2 = runtime.getSpriteTargetByName("Test sprite");
|
||||
const b3 = b2 && b2.lookupVariableByNameAndType("Private variable", "", true);
|
||||
const b4 = stage && stage.lookupVariableByNameAndType("This variable used to exist", "", true);
|
||||
const b5 = stage.variables["GTmK+*w8mNQP,z`4WG8#"];
|
||||
const b6 = runtime.getSpriteTargetByName("Sprite that doesn't exist");
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 32",}, b0, false, false, null);
|
||||
if (((stage.currentCostume + 1) === 2)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass backdrop #",}, b0, false, false, null);
|
||||
}
|
||||
if ((stage.getCostumes()[stage.currentCostume].name.toLowerCase() === "Backdrop name test".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass backdrop name",}, b0, false, false, null);
|
||||
}
|
||||
if (((stage ? stage.volume : 0) === 45)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass stage volume",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + (b1 ? b1.value : 0)).toLowerCase() === "Variable in stage".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass stage variable",}, b0, false, false, null);
|
||||
}
|
||||
if (((b2 ? b2.x : 0) === 19)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass x",}, b0, false, false, null);
|
||||
}
|
||||
if (((b2 ? b2.y : 0) === 20)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass y",}, b0, false, false, null);
|
||||
}
|
||||
if (((b2 ? b2.direction : 0) === 89)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass direction",}, b0, false, false, null);
|
||||
}
|
||||
if (((b2 ? b2.currentCostume + 1 : 0) === 3)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass costume #",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + (b2 ? b2.getCostumes()[b2.currentCostume].name : 0)).toLowerCase() === "Costume name test".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass costume name",}, b0, false, false, null);
|
||||
}
|
||||
if (((b2 ? b2.size : 0) === 76.01)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass size",}, b0, false, false, null);
|
||||
}
|
||||
if (((b2 ? b2.volume : 0) === 14.3)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass volume",}, b0, false, false, null);
|
||||
}
|
||||
if ((("" + (b3 ? b3.value : 0)).toLowerCase() === "Private variable value".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass private variable",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual((b4 ? b4.value : 0), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass non existent variable",}, b0, false, false, null);
|
||||
}
|
||||
b5.value = (("" + randomInt(1, 9)) + ("" + randomInt(1, 9)));
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: b5.value, PROPERTY: "backdrop #" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE backdrop #",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "backdrop name" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE backdrop name",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "volume" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE volume",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "Stage variable" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE stage variable",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "x position" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE x",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "y position" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE y",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "direction" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE direction",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "costume #" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE costume #",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "costume name" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE costume name",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "size" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE size",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "volume" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE volume",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ("" + b5.value), PROPERTY: "Private variable" }), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE private variable",}, b0, false, false, null);
|
||||
}
|
||||
if (((b6 ? b6.x : 0) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE backdrop #",}, b0, false, false, null);
|
||||
}
|
||||
if (((b6 ? b6.y : 0) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE backdrop name",}, b0, false, false, null);
|
||||
}
|
||||
if (((b6 ? b6.direction : 0) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE volume",}, b0, false, false, null);
|
||||
}
|
||||
if (((b6 ? b6.currentCostume + 1 : 0) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE stage variable",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual((b6 ? b6.getCostumes()[b6.currentCostume].name : 0), 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE x",}, b0, false, false, null);
|
||||
}
|
||||
if (((b6 ? b6.size : 0) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE y",}, b0, false, false, null);
|
||||
}
|
||||
if (((b6 ? b6.volume : 0) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass NE direction",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,46 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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);
|
||||
b1.value = "Initial";
|
||||
thread.timer = timer();
|
||||
var a0 = Math.max(0, 1000 * 0);
|
||||
runtime.requestRedraw();
|
||||
yield;
|
||||
while (thread.timer.timeElapsed() < a0) {
|
||||
yield;
|
||||
}
|
||||
thread.timer = null;
|
||||
yield* waitThreads(startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "Test 1" }));
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// 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 () {
|
||||
if ((("" + b0.value).toLowerCase() === "Initial".toLowerCase())) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b1, false, false, null);
|
||||
}
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Stage script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
return function* genXYZ () {
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Stage script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = target.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"];
|
||||
return function* genXYZ () {
|
||||
b0.value = "Stage callback";
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,13 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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, null);
|
||||
if (!((Infinity - Infinity) <= 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,55 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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, null);
|
||||
if ((tan(0) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 0",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(90) === Infinity)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 90",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(180) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 180",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(270) === -Infinity)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 270",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(360) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 360",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(450) === Infinity)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 450",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(540) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 540",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(630) === -Infinity)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 630",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(720) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 720",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(810) === Infinity)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 810",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(-90) === -Infinity)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass -90",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(-180) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass -180",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(-270) === Infinity)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass -270",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(-360) === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass -360",}, b0, false, false, null);
|
||||
}
|
||||
if ((tan(-450) === -Infinity)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass -450",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,85 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Sprite2 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[",OktMIwz{~bdgWnPEa8u"];
|
||||
const b2 = stage.variables["yfy(G`K5K^fJcXAfiN4i"];
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 14",}, b0, false, false, null);
|
||||
if ((10 === 10)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 1",}, b0, false, false, null);
|
||||
}
|
||||
if ((10 === 10)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 2",}, b0, false, false, null);
|
||||
}
|
||||
b1.value = 10;
|
||||
if (((+b1.value || 0) === 10)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 3",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(b1.value, "010")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 4",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(b1.value, "0000000010")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 5",}, b0, false, false, null);
|
||||
}
|
||||
for (var a0 = 1; a0 >= 0.5; a0--) {
|
||||
if (((+b1.value || 0) === 10)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 6",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(b1.value, "010")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 7",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(b1.value, "0000000010")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 8",}, b0, false, true, null);
|
||||
if (hasResumedFromPromise) {hasResumedFromPromise = false;continue;}
|
||||
}
|
||||
yield;
|
||||
}
|
||||
b2.value = "010";
|
||||
if (((+b2.value || 0) === 10)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 9",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(b2.value, "010")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 10",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(b2.value, "0000000010")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 11",}, b0, false, false, null);
|
||||
}
|
||||
for (var a1 = 1; a1 >= 0.5; a1--) {
|
||||
if (((+b2.value || 0) === 10)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 12",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(b2.value, "010")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 13",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(b2.value, "0000000010")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass 14",}, b0, false, true, null);
|
||||
if (hasResumedFromPromise) {hasResumedFromPromise = false;continue;}
|
||||
}
|
||||
yield;
|
||||
}
|
||||
if ((0 === 1)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, null);
|
||||
}
|
||||
if ((1 === 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, null);
|
||||
}
|
||||
if ((0 === 1)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(" ", 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(0, " ")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual("", 0)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, null);
|
||||
}
|
||||
if (compareEqual(0, "")) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"fail",}, b0, false, false, null);
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,26 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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, null);
|
||||
yield* thread.procedures["Wrun without screen refresh"]();
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite1 run without screen refresh
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["F?*}X,`9XBpN_[piGRrz"];
|
||||
const b1 = runtime.getOpcodeFunction("looks_say");
|
||||
return function* genXYZ_run_without_screen_r () {
|
||||
b0.value = (((daysSince2000() * 86400) || 0) + 3);
|
||||
runtime.ioDevices.clock.resetProjectTimer();
|
||||
while (!((runtime.ioDevices.clock.projectTimer() > 0.1) || compareGreaterThan((daysSince2000() * 86400), b0.value))) {
|
||||
if (isStuck()) yield;
|
||||
}
|
||||
if (compareLessThan((daysSince2000() * 86400), b0.value)) {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b1, true, false, null);
|
||||
}
|
||||
}; })
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// 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 0",}, b0, false, false, null);
|
||||
runtime.ext_scratch3_looks._setBackdrop(stage, stage.currentCostume + 1, true);
|
||||
retire();
|
||||
}; })
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// TW Snapshot
|
||||
|
||||
// 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":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// 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 0",}, b0, false, false, null);
|
||||
runtime.ext_scratch3_looks._setBackdrop(stage, "backdrop2");
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,31 @@
|
||||
// TW Snapshot
|
||||
|
||||
// Sprite2 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["7qur6!bGgvC9I(Nd5.HP"];
|
||||
const b2 = stage.variables["sUOp@-6J4y0PqwiXit4!"];
|
||||
return function* genXYZ () {
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, null);
|
||||
b1.value = 0;
|
||||
b2.value = "";
|
||||
while (!compareGreaterThan(b2.value, "")) {
|
||||
startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "step" });
|
||||
yield;
|
||||
}
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, null);
|
||||
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, null);
|
||||
retire();
|
||||
}; })
|
||||
|
||||
// Sprite2 script
|
||||
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
|
||||
const b0 = stage.variables["7qur6!bGgvC9I(Nd5.HP"];
|
||||
const b1 = stage.variables["sUOp@-6J4y0PqwiXit4!"];
|
||||
return function* genXYZ () {
|
||||
b0.value = ((+b0.value || 0) + 1);
|
||||
if (((b0.value || 0) === 5)) {
|
||||
b1.value = "end";
|
||||
}
|
||||
retire();
|
||||
}; })
|
||||
@@ -0,0 +1,100 @@
|
||||
const Snapshot = require('./snapshots.js');
|
||||
|
||||
/* eslint-disable no-console */
|
||||
|
||||
const RESET = `\u001b[0m`;
|
||||
const BOLD = '\u001b[1m';
|
||||
const RED = '\u001b[31m';
|
||||
const BLUE = `\u001b[34m`;
|
||||
const GREEN = '\u001b[32m';
|
||||
const GRAY = '\u001b[90m';
|
||||
|
||||
const PASSED = 'PASSED';
|
||||
const FAILED = 'FAILED';
|
||||
const UPDATED = 'UPDATED';
|
||||
|
||||
const isUpdatingSnapshots = process.argv.includes('--update');
|
||||
|
||||
const runSnapshotTest = async test => {
|
||||
try {
|
||||
const generatedSnapshot = await Snapshot.generateActualSnapshot(test);
|
||||
const expectedSnapshot = Snapshot.getExpectedSnapshot(test);
|
||||
const matches = generatedSnapshot === expectedSnapshot;
|
||||
|
||||
const prefix = `### ${test}: `;
|
||||
|
||||
if (isUpdatingSnapshots) {
|
||||
if (matches) {
|
||||
console.log(`${BOLD}${GREEN}${prefix}already matches${RESET}`);
|
||||
return PASSED;
|
||||
}
|
||||
console.log(`${BOLD}${BLUE}### ${test}: updating${RESET}`);
|
||||
Snapshot.saveSnapshot(test, generatedSnapshot);
|
||||
return UPDATED;
|
||||
}
|
||||
|
||||
if (matches) {
|
||||
console.log(`${BOLD}${GREEN}### ${test}: matches${RESET}`);
|
||||
return PASSED;
|
||||
}
|
||||
|
||||
if (expectedSnapshot === null) {
|
||||
console.log(`${BOLD}${BLUE}### ${test}: missing data, saving generated snapshot${RESET}`);
|
||||
Snapshot.saveSnapshot(test, generatedSnapshot);
|
||||
return UPDATED;
|
||||
}
|
||||
|
||||
console.log(`${BOLD}${RED}### ${test}: DOES NOT MATCH${RESET}`);
|
||||
console.log(`${RED}EXPECTED:\n${expectedSnapshot}${RESET}`);
|
||||
console.log(`${BLUE}GOT:\n${generatedSnapshot}${RESET}`);
|
||||
} catch (e) {
|
||||
console.log(`${BOLD}${RED}### ${test}: ERROR${RESET}`);
|
||||
console.log(`${RED}${e}${RESET}`);
|
||||
}
|
||||
|
||||
console.log('');
|
||||
return FAILED;
|
||||
};
|
||||
|
||||
const run = async () => {
|
||||
console.log(`Running ${Snapshot.tests.length} snapshot tests.`);
|
||||
|
||||
const fileToResult = {};
|
||||
for (const test of Snapshot.tests) {
|
||||
fileToResult[test] = await runSnapshotTest(test);
|
||||
}
|
||||
|
||||
const getTestsByResult = r => Object.entries(fileToResult)
|
||||
.filter(i => i[1] === r)
|
||||
.map(i => i[0]);
|
||||
|
||||
const passed = getTestsByResult(PASSED);
|
||||
const failed = getTestsByResult(FAILED);
|
||||
const updated = getTestsByResult(UPDATED);
|
||||
|
||||
console.log('');
|
||||
console.log(`${BOLD} === SUMMARY ===${RESET}`);
|
||||
if (passed.length) {
|
||||
console.log(`${BOLD}${GREEN}PASSED ${passed.length}${RESET}${GRAY} ${passed.join(', ')}${RESET}`);
|
||||
}
|
||||
if (failed.length) {
|
||||
console.log(`${BOLD}${RED}FAILED ${failed.length}${RESET}${GRAY} ${failed.join(', ')}${RESET}`);
|
||||
}
|
||||
if (updated.length) {
|
||||
console.log(`${BOLD}${BLUE}UPDATED ${updated.length}${RESET}${GRAY} ${updated.join(', ')}${RESET}`);
|
||||
}
|
||||
|
||||
if (failed.length) {
|
||||
console.log('');
|
||||
console.log(`If the compiler's behavior has changed, this failure is expected.`);
|
||||
console.log(`Update snapshots with ${BOLD}node snapshot-tests --update${RESET}`);
|
||||
console.log(`Review the diff in version control, then commit the updated snapshot files.`);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
run()
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const VM = require('../src/virtual-machine');
|
||||
const JSGenerator = require('../src/compiler/jsgen');
|
||||
|
||||
const executeDir = path.resolve(__dirname, '../test/fixtures/execute');
|
||||
// sb2 project loading results in random IDs each time, so for now we only snapshot sb3 files
|
||||
const testProjects = fs.readdirSync(executeDir).filter(uri => uri.endsWith('.sb3'));
|
||||
|
||||
const snapshotDir = path.resolve(__dirname, '__snapshots__');
|
||||
fs.mkdirSync(snapshotDir, {
|
||||
recursive: true
|
||||
});
|
||||
|
||||
const getProjectData = file => fs.readFileSync(path.join(executeDir, file));
|
||||
|
||||
const getSnapshotPath = file => path.join(snapshotDir, `${file}.tw-snapshot`);
|
||||
|
||||
const generateActualSnapshot = async file => {
|
||||
const vm = new VM();
|
||||
await vm.loadProject(getProjectData(file));
|
||||
|
||||
/*
|
||||
Example source (manually formatted):
|
||||
(function factory32(thread) {
|
||||
const target = thread.target;
|
||||
const runtime = target.runtime;
|
||||
const stage = runtime.getTargetForStage();
|
||||
return function* gen30_whatever () {
|
||||
// ...
|
||||
};
|
||||
}; })
|
||||
*/
|
||||
const normalizeJS = source => source
|
||||
.replace(/^\(function factory\d+/, '(function factoryXYZ')
|
||||
.replace(/return function\* gen\d+/, 'return function* genXYZ')
|
||||
.replace(/return function fun\d+/, 'return function funXYZ');
|
||||
|
||||
const generatedJS = [];
|
||||
JSGenerator.testingApparatus = {
|
||||
report: (jsgen, factorySource) => {
|
||||
const targetName = jsgen.target.getName();
|
||||
const scriptName = jsgen.script.procedureCode || 'script';
|
||||
const js = normalizeJS(factorySource);
|
||||
generatedJS.push(`// ${targetName} ${scriptName}\n${js}`);
|
||||
}
|
||||
};
|
||||
|
||||
vm.runtime.precompile();
|
||||
|
||||
return `// TW Snapshot\n\n${generatedJS.join('\n\n')}\n`;
|
||||
};
|
||||
|
||||
const getExpectedSnapshot = test => {
|
||||
try {
|
||||
return fs.readFileSync(getSnapshotPath(test), 'utf-8');
|
||||
} catch (e) {
|
||||
if (e.code === 'ENOENT') {
|
||||
return null;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
const saveSnapshot = (test, data) => {
|
||||
fs.writeFileSync(getSnapshotPath(test), data);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
tests: testProjects,
|
||||
generateActualSnapshot,
|
||||
getExpectedSnapshot,
|
||||
saveSnapshot
|
||||
};
|
||||
@@ -1310,8 +1310,15 @@ class JSGenerator {
|
||||
log.info(`JS: ${this.target.getName()}: compiled ${this.script.procedureCode || 'script'}`, factory);
|
||||
}
|
||||
|
||||
if (JSGenerator.testingApparatus) {
|
||||
JSGenerator.testingApparatus.report(this, factory);
|
||||
}
|
||||
|
||||
return fn;
|
||||
}
|
||||
}
|
||||
|
||||
// Test hook used by automated snapshot testing.
|
||||
JSGenerator.testingApparatus = null;
|
||||
|
||||
module.exports = JSGenerator;
|
||||
@@ -0,0 +1,20 @@
|
||||
const {test} = require('tap');
|
||||
const Snapshots = require('../../snapshot-tests/snapshots');
|
||||
|
||||
for (const testName of Snapshots.tests) {
|
||||
test(testName, async t => {
|
||||
const expected = Snapshots.getExpectedSnapshot(testName);
|
||||
if (expected) {
|
||||
const actual = await Snapshots.generateActualSnapshot(testName);
|
||||
if (actual === expected) {
|
||||
t.pass('matches');
|
||||
} else {
|
||||
// This assertion will always fail, but tap will print a readable diff
|
||||
t.equal(expected, actual, 'did not match; you may have to run: node snapshot-tests --update');
|
||||
}
|
||||
} else {
|
||||
t.fail('missing snapshot, please run: node snapshot-tests --update');
|
||||
}
|
||||
t.end();
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user