mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Finish coverage tests.
This commit is contained in:
parent
7623c444a8
commit
1747028211
2 changed files with 8 additions and 2 deletions
|
@ -336,7 +336,7 @@ class optimizer(object):
|
||||||
if code0 in ('V++','V--','--V','++V',';'):
|
if code0 in ('V++','V--','--V','++V',';'):
|
||||||
return
|
return
|
||||||
|
|
||||||
raise Exception('Internal error: This should not happen, node = ' + code0)
|
raise Exception('Internal error: This should not happen, node = ' + code0) # pragma: no cover
|
||||||
|
|
||||||
def Fold(self, code, IsGlobal = True):
|
def Fold(self, code, IsGlobal = True):
|
||||||
assert type(code) == tuple
|
assert type(code) == tuple
|
||||||
|
|
|
@ -180,6 +180,8 @@ class Test02_Compiler(UnitTestCase):
|
||||||
self.assertRaises(EParseTypeMismatch, self.parser.parse, '''f(){string i;(i&=i);}''',
|
self.assertRaises(EParseTypeMismatch, self.parser.parse, '''f(){string i;(i&=i);}''',
|
||||||
set(('extendedassignment')))
|
set(('extendedassignment')))
|
||||||
|
|
||||||
|
self.assertRaises(EParseUndefined, self.parser.parse, '''key a=b;key b;default{timer(){}}''',
|
||||||
|
['extendedglobalexpr'])
|
||||||
# Force a list constant down its throat, to test coverage of LIST_VALUE
|
# Force a list constant down its throat, to test coverage of LIST_VALUE
|
||||||
self.parser.constants['LISTCONST']=[1,2,3]
|
self.parser.constants['LISTCONST']=[1,2,3]
|
||||||
print self.outscript.output(self.parser.parse('default{timer(){LISTCONST;}}'))
|
print self.outscript.output(self.parser.parse('default{timer(){LISTCONST;}}'))
|
||||||
|
@ -234,6 +236,7 @@ class Test03_Optimizer(UnitTestCase):
|
||||||
float ffff=vvvv.x;
|
float ffff=vvvv.x;
|
||||||
vector vvvv2=vvvv;
|
vector vvvv2=vvvv;
|
||||||
float ffff3 = v.z;
|
float ffff3 = v.z;
|
||||||
|
integer fn(){return fn();}
|
||||||
|
|
||||||
default{touch(integer n){
|
default{touch(integer n){
|
||||||
1+([]+(integer)~1);
|
1+([]+(integer)~1);
|
||||||
|
@ -252,7 +255,10 @@ class Test03_Optimizer(UnitTestCase):
|
||||||
"a" "b" "c";
|
"a" "b" "c";
|
||||||
"a"+(key)"b"; (key)"a" + "b";
|
"a"+(key)"b"; (key)"a" + "b";
|
||||||
i>>=i;
|
i>>=i;
|
||||||
if (1) do while (0); while (0); if (0) ; else ;
|
if (1) do while (0); while (0); if (0); if (0);else; for(;0;);
|
||||||
|
if (i) ; else ; while (i) ; do ; while (i); for(;i;);
|
||||||
|
do while (1); while(1); for(;1;);
|
||||||
|
for (i=0,i;0;);for(i=0,i=0;0;);return;
|
||||||
}}''',
|
}}''',
|
||||||
['explicitcast','extendedtypecast','extendedassignment',
|
['explicitcast','extendedtypecast','extendedassignment',
|
||||||
'extendedglobalexpr', 'allowmultistrings', 'allowkeyconcat']
|
'extendedglobalexpr', 'allowmultistrings', 'allowkeyconcat']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue