Commit b91f4019 authored by Sergio Costas's avatar Sergio Costas

Now checks that the types when assigning a value to a variable are or both...

Now checks that the types when assigning a value to a variable are or both crust_t, or both non-crust_t
parent e55f2808
This diff is collapsed.
......@@ -112,6 +112,13 @@ class Test(unittest.TestCase):
def testAssignUninitializedVariable(self):
self._generic_test("unitest/test23.c",False,crusty.crusty.MSG_ERROR,"Using the value of '{:s}' at line {:d} in an assignment, but it is uninitialized","param4",5)
def testAssignNonCrustToCrust(self):
self._generic_test("unitest/test24.c",False,crusty.crusty.MSG_CRITICAL,"Assigning a non-crust pointer to the crust variable '{:s}' at line {:d}","param5",5)
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)
if __name__ == '__main__':
unittest.main()
typedef __crust_t__ int * crust_t;
int function() {
int * param4 = NULL;
crust_t param5 = param4;
}
typedef __crust_t__ int * crust_t;
int function() {
crust_t param4 = NULL;
int * param5 = param4;
}
......@@ -2,5 +2,5 @@ typedef __crust_t__ unsigned char *crust_t;
int function(crust_t param3) {
crust_t param4;
crust_t retval = function(param4);
int retval = function(param4);
}
......@@ -2,6 +2,6 @@ typedef __crust_t__ unsigned char *crust_t;
int function(crust_t param3) {
crust_t retval = function(param3);
crust_t retval2 = function(param3);
int retval = function(param3);
int retval2 = function(param3);
}
......@@ -3,5 +3,5 @@ typedef __crust_t__ unsigned char *crust_t;
int function(crust_t param3) {
int *param = 1;
crust_t retval = function(param);
int retval = function(param);
}
typedef __crust_t__ unsigned char *crust_t;
int function(int param3) {
crust_t function(int param3) {
crust_t *param = 1;
crust_t *param = NULL;
crust_t retval = function(param);
}
......@@ -2,5 +2,5 @@ typedef __crust_t__ unsigned char *crust_t;
int function(crust_t param3) {
crust_t retval = function(2);
int retval = function(2);
}
......@@ -2,5 +2,5 @@ typedef __crust_t__ unsigned char *crust_t;
int function(crust_t param3) {
crust_t retval = function(3,5);
int retval = function(3,5);
}
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