Commit ae7569cd authored by Sergio Costas's avatar Sergio Costas

Added test for typecast

parent d4b5ab7a
......@@ -29,15 +29,18 @@ class Test(unittest.TestCase):
self._test_msg(lib,error_element,*params)
def testAllFine(self):
# This test just must work
def _all_fine_test(self,filename):
lib = crusty.crusty("lexyacclib/crusty.h","lexyacclib/crusty.so")
tree = lib.read_file("unitest/test1.c",False)
tree = lib.read_file(filename,False)
self.assertIsNot(tree,None)
variables,functions = lib.process_tree(tree)
lib.process_functions(tree,variables,functions)
self.assertEqual(len(lib.errors),0)
def testAllFine(self):
# This test just must work
self._all_fine_test("unitest/test1.c")
def testUnknownVariable(self):
# This test must fail with an Unknown variable exception and the corresponding error message
lib = crusty.crusty("lexyacclib/crusty.h","lexyacclib/crusty.so")
......@@ -118,6 +121,8 @@ class Test(unittest.TestCase):
def testAssignCrustToNonCrust(self):
self._generic_test("unitest/test25.c",False,crusty.crusty.MSG_CRITICAL,"Assigning a crust pointer to the non-crust variable '{:s}' at line {:d}","param5",5)
def testTypeCast(self):
self._all_fine_test("unitest/test26.c")
if __name__ == '__main__':
......
typedef __crust_t__ unsigned char *crust_t;
int function(crust_t param3) {
int v = 5;
crust_t *param = (crust_t) v;
}
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