Commit 2b86a7ee authored by Sergio's avatar Sergio

Fully support for switch, and tests

parent fff8ce27
......@@ -689,6 +689,15 @@ class Test(unittest.TestCase):
def test139BreakInNestedFor(self):
self._generic_test("unitest/test139.c", [ (crust.crust.MSG_ERROR, "Memory block '{:s}', initialized at line {:d}, is still in use at exit point at line {:d}", "param2", 7, 22), (crust.crust.MSG_ERROR, "Memory block '{:s}', initialized at line {:d}, is still in use at exit point at line {:d}", "param1", 7, 22) ])
def test140Switch1(self):
self._generic_test("unitest/test140.c", [ (crust.crust.MSG_ERROR, "Memory block '{:s}', initialized at line {:d}, is still in use at exit point at line {:d}", "param1", 7, 27), (crust.crust.MSG_ERROR, "Memory block '{:s}', initialized at line {:d}, is still in use at exit point at line {:d}", "param2", 7, 27), (crust.crust.MSG_ERROR, "Memory block '{:s}', initialized at line {:d}, is still in use at exit point at line {:d}", "param3", 7, 27) ])
def test141Switch2(self):
self._generic_test("unitest/test141.c", [ (crust.crust.MSG_ERROR, "Parameter {:d} when calling function '{:s}' at line {:d} was freed at line {:d}", 1, "function", 25, 13), (crust.crust.MSG_ERROR, "Parameter {:d} when calling function '{:s}' at line {:d} was freed at line {:d}", 1, "function", 25, 16), (crust.crust.MSG_ERROR, "Parameter {:d} when calling function '{:s}' at line {:d} was freed at line {:d}", 1, "function", 25, 19), (crust.crust.MSG_ERROR, "Parameter {:d} when calling function '{:s}' at line {:d} was freed at line {:d}", 1, "function", 25, 22) ])
def test142Switc3(self):
self._generic_test("unitest/test142.c", [ (crust.crust.MSG_ERROR, "Parameter {:d} when calling function '{:s}' at line {:d} was freed at line {:d}", 1, "function", 17, 15), (crust.crust.MSG_ERROR, "Parameter {:d} when calling function '{:s}' at line {:d} was freed at line {:d}", 1, "function", 17, 13), (crust.crust.MSG_ERROR, "Parameter {:d} when calling function '{:s}' at line {:d} was freed at line {:d}", 1, "function", 15, 13) ])
if __name__ == '__main__':
try:
os.remove("error_list.txt")
......
typedef __crust_t__ unsigned char *crust_t;
#define NULL ((void *)0)
void function(crust_t param);
void main(crust_t param1) {
int a;
switch (a) {
case 0:
function(param1);
break;
case 1:
function(param1);
break;
case 3:
function(param1);
break;
default:
function(param1);
break;
}
function(param1);
}
typedef __crust_t__ unsigned char *crust_t;
#define NULL ((void *)0)
void function(crust_t param);
void main(crust_t param1) {
int a;
switch (a) {
case 0:
function(param1);
case 1:
function(param1);
case 3:
function(param1);
break;
default:
function(param1);
break;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment