Transpiled version (32993L) is out of date.
!include once #1034831 // Gazelle 22 Function Include for Testing svoid test_compiledLeftArrowScript() { embedded S countLoop(int n) { ret [[ i <- 0; while lessThan i ]] + n + [[ { i <- plus i 1 }; i ]]; } embedded void testScript(S script, O expectedValue) { var makeIF0 = leftArrowScriptToEvaluable(leftArrowParse(script)); makeIF0.printDisassembly(true); print(+script); assertEqualsVerbose(expectedValue, makeIF0!!); } // int primitive testScript([[ 5 ]], 5); testScript([[ -5 ]], -5); // double primitive testScript([[ str 1.5e2 ]], "150.0"); // new object with constructor arguments testScript([[ new Pair "hello" "world" ]], pair("hello", "world")); // assign & get variable testScript([[ i <- 23; i ]], 23); // while loop testScript(countLoop(5), 5); // conditional return testScript([[ if true { return "so true" } return "oops" ]], "so true"); testScript([[ if false { return "not true" } return "but this" ]], "but this"); }
Began life as a copy of #1033988
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034324 |
Snippet name: | test_compiledLeftArrowScript - test left-arrow script compiled to byte code. only a few cases so far (OK) |
Eternal ID of this version: | #1034324/10 |
Text MD5: | 4d5720ac72a9e69c9948dc49a4df561b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-11 02:26:12 |
Source code size: | 1082 bytes / 42 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 141 / 320 |
Version history: | 9 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |