Mercurial > lcfOS
diff test/testc3.py @ 308:2e7f55319858
Merged analyse into codegenerator
author | Windel Bouwman |
---|---|
date | Fri, 13 Dec 2013 11:53:29 +0100 |
parents | e609d5296ee9 |
children | ff665880a6b0 |
line wrap: on
line diff
--- a/test/testc3.py Thu Dec 12 20:42:56 2013 +0100 +++ b/test/testc3.py Fri Dec 13 11:53:29 2013 +0100 @@ -237,6 +237,36 @@ """ self.expectOK(snippet) + def testAndCondition(self): + snippet = """ + module tst; + function void t() { + if (4 > 3 and 1 < 10) { + } + } + """ + self.expectOK(snippet) + + def testOrCondition(self): + snippet = """ + module tst; + function void t() { + if (3 > 4 or 3 < 10) { + } + } + """ + self.expectOK(snippet) + + def testNonBoolCondition(self): + snippet = """ + module tst; + function void t() { + if (3) { + } + } + """ + self.expectErrors(snippet, [4]) + def testTypeDef(self): snippet = """ module testtypedef; @@ -284,6 +314,17 @@ """ self.expectOK(snippet) + def testStruct2(self): + """ Select struct member from non struct type """ + snippet = """ + module teststruct1; + function void t() { + var int a; + a.z = 2; + } + """ + self.expectErrors(snippet, [5]) + def testStructCall(self): snippet = """ module teststruct1; @@ -293,7 +334,7 @@ a.x(9); } """ - self.expectOK(snippet) + self.expectErrors(snippet, [6]) def testPointerType1(self): snippet = """ @@ -304,6 +345,7 @@ var int a; pa = &a; *pa = 22; + a = *pa + *pa * 8; } """ self.expectOK(snippet) @@ -374,7 +416,7 @@ *cast<gpio>(*a); } """ - self.expectErrors(snippet, [7, 7]) + self.expectErrors(snippet, [7]) def testComplexType(self): snippet = """