mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Add forgotten unit tests for the identifier substitution fiasco
This commit is contained in:
parent
0877f8c7e6
commit
352f410d12
3 changed files with 49 additions and 0 deletions
25
unit_tests/regression.suite/aggressive-local-removal.lsl
Normal file
25
unit_tests/regression.suite/aggressive-local-removal.lsl
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
default
|
||||||
|
{
|
||||||
|
state_entry()
|
||||||
|
{
|
||||||
|
list L1 = [1, 2, 3, 4, 5];
|
||||||
|
integer N = llGetListLength(L1);
|
||||||
|
integer i;
|
||||||
|
for (i = 0; i < N; i++)
|
||||||
|
{
|
||||||
|
llOwnerSay(llList2String(L1, i));
|
||||||
|
L1 = llDeleteSubList(L1, -1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Swap two variables
|
||||||
|
integer u = llGetLinkNumber();
|
||||||
|
integer v = llGetNumberOfPrims();
|
||||||
|
if (llFrand(1) < 0.5)
|
||||||
|
{
|
||||||
|
integer temp = u;
|
||||||
|
u = v;
|
||||||
|
v = temp;
|
||||||
|
}
|
||||||
|
llOwnerSay((string)u+(string)v);
|
||||||
|
}
|
||||||
|
}
|
23
unit_tests/regression.suite/aggressive-local-removal.out
Normal file
23
unit_tests/regression.suite/aggressive-local-removal.out
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
default
|
||||||
|
{
|
||||||
|
state_entry()
|
||||||
|
{
|
||||||
|
list loc_L1 = (list)1 + 2 + 3 + 4 + 5;
|
||||||
|
integer loc_N = loc_L1 != [];
|
||||||
|
integer loc_i;
|
||||||
|
for (loc_i = 0; loc_i < loc_N; ++loc_i)
|
||||||
|
{
|
||||||
|
llOwnerSay(llList2String(loc_L1, loc_i));
|
||||||
|
loc_L1 = llDeleteSubList(loc_L1, ((integer)-1), ((integer)-1));
|
||||||
|
}
|
||||||
|
integer loc_u = llGetLinkNumber();
|
||||||
|
integer loc_v = llGetNumberOfPrims();
|
||||||
|
if (llFrand(1) < 0.5)
|
||||||
|
{
|
||||||
|
integer loc_temp = loc_u;
|
||||||
|
loc_u = loc_v;
|
||||||
|
loc_v = loc_temp;
|
||||||
|
}
|
||||||
|
llOwnerSay((string)loc_u + (string)loc_v);
|
||||||
|
}
|
||||||
|
}
|
1
unit_tests/regression.suite/aggressive-local-removal.run
Normal file
1
unit_tests/regression.suite/aggressive-local-removal.run
Normal file
|
@ -0,0 +1 @@
|
||||||
|
main.py - -y -O shrinknames
|
Loading…
Add table
Add a link
Reference in a new issue