mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
This test suite has been in use for a long time now, in place of the obsolete and unmanageable testparser.py and testfuncs.py. It verifies the complete optimizer output to stdout and stderr, to ensure that the output matches the expectations. See unit_tests/README.txt for more info.
37 lines
931 B
Text
37 lines
931 B
Text
default{timer(){
|
|
|
|
integer a = (integer)llFrand(100);
|
|
|
|
// Check optimization of if
|
|
|
|
if (a) ;
|
|
if (a) a;
|
|
if (a) a; else a;
|
|
if (a) {@b;} else {@c;}
|
|
//if (a) @d;
|
|
if (a) llDie();
|
|
if (a) ; else llDie();
|
|
if ((float)a) ; else llDie();
|
|
if ((string)a) ; else llDie();
|
|
if ((key)((string)a)) ; else llDie();
|
|
if (<a,0,0>) ; else llDie();
|
|
if (<a,0,0,1>) ; else llDie();
|
|
if ((list)a) ; else llDie();
|
|
if (!a) llDie(); else llOwnerSay("ok");
|
|
if (a == 3) llDie(); else llOwnerSay("ok");
|
|
if (a > 5) if (a == 12) ; else llDie(); else llOwnerSay("ok");
|
|
if (a == 12) llOwnerSay("1"); else if (a > 5) llOwnerSay("2");
|
|
if (a > 5) if (a == 12) ; else /*@f1*/; else llDie();
|
|
if (a == 12) llDie(); else if (a > 5) /*@f4*/;
|
|
// Fixed: Regression: this produces if (!(a == 3)) and no optimization kicks in
|
|
if (a != 3) llOwnerSay("fixed");
|
|
|
|
// Regression
|
|
if (a == 2)
|
|
llOwnerSay("a");
|
|
else if (a)
|
|
llOwnerSay("b");
|
|
else if (a == 3)
|
|
llOwnerSay("c");
|
|
|
|
}}
|