!include once #1034034 // Gazelle 22 Function Include for Scripts set flag PingV3. svoid test_leftArrowScript() { embedded S countLoop(int n) { ret [[ i <- 0; while lessThan i ]] + n + [[ { i <- plus i 1 }; i ]]; } testFunctionValues(script -> leftArrowVerbose((S) script), // int primitive [[ 5 ]], 5, [[ -5 ]], -5, // function definition & call [[ def double x { Math multiplyExact x 2 } double 10 ]], 20, // new object with constructor arguments [[ new Pair "hello" "world" ]], pair("hello", "world"), // double primitive [[ str 1.5e2 ]], "150.0", // [not implemented, too complicated] // last = result of last statement // [[ plus 1 2; Math addExact 5 last ]], 8, // get static field [[ Color black ]], Color.black, // while loop countLoop(5), 5, // if statement [[ if lessThan 0 1 { "ok" } ]], "ok", [[ if lessThan 1 0 { "ok" } ]], null, ); // Test that ping is called at least once per loop iteration var script1 = leftArrowParse(countLoop(5)); var script2 = leftArrowParse(countLoop(6)); int pingCount1 = countPingCalls(script1); int pingCount2 = countPingCalls(script2); printVars(+pingCount1, +pingCount2); assertTrue(pingCount2 > pingCount1); }