mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-03 00:18:20 +00:00
Add the new test suite.
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.
This commit is contained in:
parent
7fbde0269c
commit
1867dc78e7
547 changed files with 11680 additions and 0 deletions
20
unit_tests/lso.suite/casts.lsl
Normal file
20
unit_tests/lso.suite/casts.lsl
Normal file
|
@ -0,0 +1,20 @@
|
|||
[ (string)-.5e-6
|
||||
, (string)((float)"-0x1.0C6F7Ap-21")
|
||||
, (string)((float)"0x1.0C6F7Ap-21")
|
||||
, (string)((float)"-0x1.0C6F7Cp-21")
|
||||
, (string)((float)"0x1.0C6F7Cp-21")
|
||||
, (string)<.5e-5,(float)"-0x1.4F8B58p-18",(float)"0x1.4F8B58p-18">
|
||||
, (string)<(float)"-0x1.4F8B5Ap-18", (float)"0x1.4F8B5Ap-18", 9.999999>
|
||||
, (string)-123456789.
|
||||
, (string)-123456784.
|
||||
, (string)-123456740.
|
||||
, (string)-12345.674
|
||||
, (string)-1.2345674
|
||||
, (string)-1.2345675
|
||||
, (string)<-123456740., -12345.674, -1.2345674, -1.234564>
|
||||
, (string)[<-123456750., -12345.675, -12345.676>]
|
||||
, (string)<-123456750., -12345.675, -12345.676, -12.345675>
|
||||
, (string)<1234567.5, 1234567.4, 123456.75, 123456.74>
|
||||
, (string)[<1234567.5, 1234567.4, 0.>]
|
||||
, (string)<12345675., 12345674., 9.99999>
|
||||
]
|
20
unit_tests/lso.suite/casts.out
Normal file
20
unit_tests/lso.suite/casts.out
Normal file
|
@ -0,0 +1,20 @@
|
|||
[ "-0.000000"
|
||||
, "-0.000000"
|
||||
, "0.000000"
|
||||
, "-0.000001"
|
||||
, "0.000001"
|
||||
, "<0.00000, -0.00000, 0.00000>"
|
||||
, "<-0.00001, 0.00001, 10.00000>"
|
||||
, "-123456792.000000"
|
||||
, "-123456784.000000"
|
||||
, "-123456736.000000"
|
||||
, "-12345.673828"
|
||||
, "-1.234567"
|
||||
, "-1.234568"
|
||||
, "<-123456736.00000, -12345.67383, -1.23457, -1.23456>"
|
||||
, "<-123456752.000000, -12345.674805, -12345.675781>"
|
||||
, "<-123456752.00000, -12345.67480, -12345.67578, -12.34568>"
|
||||
, "<1234567.50000, 1234567.37500, 123456.75000, 123456.74219>"
|
||||
, "<1234567.500000, 1234567.375000, 0.000000>"
|
||||
, "<12345675.00000, 12345674.00000, 9.99999>"
|
||||
]
|
1
unit_tests/lso.suite/casts.run
Normal file
1
unit_tests/lso.suite/casts.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O clear,optimize,constfold,lso,expr,addstrings -
|
10
unit_tests/lso.suite/compare-cond.lsl
Normal file
10
unit_tests/lso.suite/compare-cond.lsl
Normal file
|
@ -0,0 +1,10 @@
|
|||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
if ([]) llOwnerSay("[]");
|
||||
if ([""]) llOwnerSay("[\"\"]");
|
||||
if (["",""]) llOwnerSay("[\"\",\"\"]");
|
||||
llOwnerSay((string)("a"!="b"));
|
||||
}
|
||||
}
|
8
unit_tests/lso.suite/compare-cond.out
Normal file
8
unit_tests/lso.suite/compare-cond.out
Normal file
|
@ -0,0 +1,8 @@
|
|||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llOwnerSay("[\"\",\"\"]");
|
||||
llOwnerSay("-1");
|
||||
}
|
||||
}
|
1
unit_tests/lso.suite/compare-cond.run
Normal file
1
unit_tests/lso.suite/compare-cond.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O -dcr,lso -
|
3
unit_tests/lso.suite/denormal-string-to-float.lsl
Normal file
3
unit_tests/lso.suite/denormal-string-to-float.lsl
Normal file
|
@ -0,0 +1,3 @@
|
|||
[ (float)"1e38"
|
||||
, (float)"-1e38"
|
||||
]
|
1
unit_tests/lso.suite/denormal-string-to-float.out
Normal file
1
unit_tests/lso.suite/denormal-string-to-float.out
Normal file
|
@ -0,0 +1 @@
|
|||
[1e38, -1e38]
|
1
unit_tests/lso.suite/denormal-string-to-float.run
Normal file
1
unit_tests/lso.suite/denormal-string-to-float.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O clear,optimize,constfold,lso,expr,addstrings -
|
16
unit_tests/lso.suite/global-key-in-list.lsl
Normal file
16
unit_tests/lso.suite/global-key-in-list.lsl
Normal file
|
@ -0,0 +1,16 @@
|
|||
// SCR-295: LSO global list declarations with keys generate string entries
|
||||
// It's apparently a consequence of SVC-1710 together with the fact that global
|
||||
// lists reuse the values verbatim, just like type casting to list does.
|
||||
|
||||
// TODO: The optim. that'd allow using llGetListEntryType is not implemented.
|
||||
// (When a list/vector/rot. variable is only read and not written, use the
|
||||
// constant value to call the function, rather than the variable, but careful
|
||||
// with llList2List etc.: ensure that the optimized result isn't bigger than
|
||||
// the unoptimized input)
|
||||
|
||||
key k = TEXTURE_BLANK;
|
||||
list L = [k,""];
|
||||
default{timer(){
|
||||
llOwnerSay((string)llGetListEntryType(L, 0));
|
||||
llOwnerSay((string)llListFindList(L, (list)k)); // in LSO, this says TYPE_STRING
|
||||
}}
|
11
unit_tests/lso.suite/global-key-in-list.out
Normal file
11
unit_tests/lso.suite/global-key-in-list.out
Normal file
|
@ -0,0 +1,11 @@
|
|||
key k = "5748decc-f629-461c-9a36-a35a221fe21f";
|
||||
list L = [k, ""];
|
||||
|
||||
default
|
||||
{
|
||||
timer()
|
||||
{
|
||||
llOwnerSay((string)llGetListEntryType(L, 0));
|
||||
llOwnerSay((string)llListFindList(L, (list)k));
|
||||
}
|
||||
}
|
1
unit_tests/lso.suite/global-key-in-list.run
Normal file
1
unit_tests/lso.suite/global-key-in-list.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O clear,lso,optimize,constfold -
|
1
unit_tests/lso.suite/invalid-unicode-unescape.err
Normal file
1
unit_tests/lso.suite/invalid-unicode-unescape.err
Normal file
|
@ -0,0 +1 @@
|
|||
ELSONotSupported: Byte strings not supported
|
1
unit_tests/lso.suite/invalid-unicode-unescape.lsl
Normal file
1
unit_tests/lso.suite/invalid-unicode-unescape.lsl
Normal file
|
@ -0,0 +1 @@
|
|||
llEscapeURL(llUnescapeURL("%80%C3"))
|
1
unit_tests/lso.suite/invalid-unicode-unescape.run
Normal file
1
unit_tests/lso.suite/invalid-unicode-unescape.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O -dcr,lso,expr -
|
7
unit_tests/lso.suite/list2key.lsl
Normal file
7
unit_tests/lso.suite/list2key.lsl
Normal file
|
@ -0,0 +1,7 @@
|
|||
[ llList2Key([], 0)
|
||||
, llList2Key([""], 1)
|
||||
, llList2Key(["a"], 0)
|
||||
, llList2Key([2], 0)
|
||||
, llList2Key([<1,0,0>],0)
|
||||
, llList2Key(llGetObjectDetails(llGetKey(), (list)OBJECT_SCRIPT_MEMORY), 0)
|
||||
]
|
7
unit_tests/lso.suite/list2key.out
Normal file
7
unit_tests/lso.suite/list2key.out
Normal file
|
@ -0,0 +1,7 @@
|
|||
[ ((key)"00000000-0000-0000-0000-000000000000")
|
||||
, ((key)"00000000-0000-0000-0000-000000000000")
|
||||
, ((key)"a")
|
||||
, ((key)"00000000-0000-0000-0000-000000000000")
|
||||
, ((key)"00000000-0000-0000-0000-000000000000")
|
||||
, ((key)"00000000-0000-0000-0000-000000000000")
|
||||
]
|
1
unit_tests/lso.suite/list2key.run
Normal file
1
unit_tests/lso.suite/list2key.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O clear,optimize,constfold,addstrings,expr,lso -
|
3
unit_tests/lso.suite/listfindlist.lsl
Normal file
3
unit_tests/lso.suite/listfindlist.lsl
Normal file
|
@ -0,0 +1,3 @@
|
|||
[ llListFindList([], [])
|
||||
, llListFindList([3], [])
|
||||
]
|
1
unit_tests/lso.suite/listfindlist.out
Normal file
1
unit_tests/lso.suite/listfindlist.out
Normal file
|
@ -0,0 +1 @@
|
|||
[-1, 0]
|
1
unit_tests/lso.suite/listfindlist.run
Normal file
1
unit_tests/lso.suite/listfindlist.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O clear,optimize,constfold,addstrings,expr,lso -
|
3
unit_tests/lso.suite/llabs.lsl
Normal file
3
unit_tests/lso.suite/llabs.lsl
Normal file
|
@ -0,0 +1,3 @@
|
|||
[ llAbs(-2147483648)
|
||||
, llAbs(0)
|
||||
]
|
1
unit_tests/lso.suite/llabs.out
Normal file
1
unit_tests/lso.suite/llabs.out
Normal file
|
@ -0,0 +1 @@
|
|||
[-2147483648, 0]
|
1
unit_tests/lso.suite/llabs.run
Normal file
1
unit_tests/lso.suite/llabs.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O clear,optimize,constfold,addstrings,expr,lso -
|
15
unit_tests/lso.suite/operators.lsl
Normal file
15
unit_tests/lso.suite/operators.lsl
Normal file
|
@ -0,0 +1,15 @@
|
|||
default
|
||||
{
|
||||
timer()
|
||||
{
|
||||
llSetPrimitiveParams(
|
||||
[ [] != []
|
||||
, [""] != []
|
||||
, [1] != []
|
||||
, [] != [1]
|
||||
, [""] == []
|
||||
, [] == []
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
14
unit_tests/lso.suite/operators.out
Normal file
14
unit_tests/lso.suite/operators.out
Normal file
|
@ -0,0 +1,14 @@
|
|||
default
|
||||
{
|
||||
timer()
|
||||
{
|
||||
llSetPrimitiveParams(
|
||||
[ 0
|
||||
, 1
|
||||
, 1
|
||||
, ((integer)-1)
|
||||
, 0
|
||||
, 1
|
||||
]);
|
||||
}
|
||||
}
|
1
unit_tests/lso.suite/operators.run
Normal file
1
unit_tests/lso.suite/operators.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O lso,-listadd -
|
12
unit_tests/lso.suite/svc-1710.lsl
Normal file
12
unit_tests/lso.suite/svc-1710.lsl
Normal file
|
@ -0,0 +1,12 @@
|
|||
default
|
||||
{
|
||||
timer()
|
||||
{
|
||||
llSetPrimitiveParams(
|
||||
[ llGetListEntryType((list)((key)""),0) // TYPE_STRING in LSO
|
||||
, llGetListEntryType((list)((string)llList2Key([],0)),0) // TYPE_KEY
|
||||
, llGetListEntryType([] + (key)"",0) // TYPE_KEY (does it right)
|
||||
, llGetListEntryType([] + (string)llList2Key([],0),0) // TYPE_KEY
|
||||
]);
|
||||
}
|
||||
}
|
7
unit_tests/lso.suite/svc-1710.out
Normal file
7
unit_tests/lso.suite/svc-1710.out
Normal file
|
@ -0,0 +1,7 @@
|
|||
default
|
||||
{
|
||||
timer()
|
||||
{
|
||||
llSetPrimitiveParams([3, 4, 4, 4]);
|
||||
}
|
||||
}
|
1
unit_tests/lso.suite/svc-1710.run
Normal file
1
unit_tests/lso.suite/svc-1710.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O lso -
|
1
unit_tests/lso.suite/svc-1710.skp
Normal file
1
unit_tests/lso.suite/svc-1710.skp
Normal file
|
@ -0,0 +1 @@
|
|||
Not implemented. TODO: Implement.
|
1
unit_tests/lso.suite/unicode-1.err
Normal file
1
unit_tests/lso.suite/unicode-1.err
Normal file
|
@ -0,0 +1 @@
|
|||
ELSONotSupported: Byte strings not supported
|
1
unit_tests/lso.suite/unicode-1.lsl
Normal file
1
unit_tests/lso.suite/unicode-1.lsl
Normal file
|
@ -0,0 +1 @@
|
|||
llUnescapeURL("%E8%B0%C0%80%90%A0%B0")
|
1
unit_tests/lso.suite/unicode-1.run
Normal file
1
unit_tests/lso.suite/unicode-1.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O clear,lso,optimize,constfold,expr,addstrings -
|
1
unit_tests/lso.suite/unicode-2.err
Normal file
1
unit_tests/lso.suite/unicode-2.err
Normal file
|
@ -0,0 +1 @@
|
|||
ELSONotSupported: Byte strings not supported
|
1
unit_tests/lso.suite/unicode-2.lsl
Normal file
1
unit_tests/lso.suite/unicode-2.lsl
Normal file
|
@ -0,0 +1 @@
|
|||
llUnescapeURL("%F3%80")
|
1
unit_tests/lso.suite/unicode-2.run
Normal file
1
unit_tests/lso.suite/unicode-2.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O clear,lso,optimize,constfold,expr,addstrings -
|
6
unit_tests/lso.suite/upper-lower.lsl
Normal file
6
unit_tests/lso.suite/upper-lower.lsl
Normal file
|
@ -0,0 +1,6 @@
|
|||
[ llToUpper("AZazAZaz")
|
||||
, llToLower("AZazAZaz")
|
||||
, llToUpper("τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός")
|
||||
, llToLower("ΤΆΧΙΣΤΗ ΑΛΏΠΗΞ ΒΑΦΉΣ ΨΗΜΈΝΗ ΓΗ, ΔΡΑΣΚΕΛΊΖΕΙ ΥΠΈΡ ΝΩΘΡΟΎ ΚΥΝΌΣ")
|
||||
, ""
|
||||
]
|
6
unit_tests/lso.suite/upper-lower.out
Normal file
6
unit_tests/lso.suite/upper-lower.out
Normal file
|
@ -0,0 +1,6 @@
|
|||
[ "AZAZAZaz"
|
||||
, "azazAZaz"
|
||||
, "τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός"
|
||||
, "ΤΆΧΙΣΤΗ ΑΛΏΠΗΞ ΒΑΦΉΣ ΨΗΜΈΝΗ ΓΗ, ΔΡΑΣΚΕΛΊΖΕΙ ΥΠΈΡ ΝΩΘΡΟΎ ΚΥΝΌΣ"
|
||||
, ""
|
||||
]
|
1
unit_tests/lso.suite/upper-lower.run
Normal file
1
unit_tests/lso.suite/upper-lower.run
Normal file
|
@ -0,0 +1 @@
|
|||
main.py -O clear,optimize,constfold,lso,expr,addstrings -
|
Loading…
Add table
Add a link
Reference in a new issue