cmockery2
cmockery2 copied to clipboard
expect_check() and expect_in_set() are broken
The expect_check() and expect_in_set() don't work. They fail even when given the correct expected data. Following is a patch that fixes both functions:
diff --git a/src/cmockery.c b/src/cmockery.c index d651e9b..ca6d8b6 100755 --- a/src/cmockery.c +++ b/src/cmockery.c @@ -972,6 +972,7 @@ static void expect_set( assert_true(number_of_values); memcpy(set, values, number_of_values * sizeof(values[0])); check_integer_set->set = set;
-
check_integer_set->size_of_set = number_of_values; _expect_check( function, parameter, file, line, check_function, check_data.value, &check_integer_set->event, count); diff --git a/src/cmockery/cmockery.h b/src/cmockery/cmockery.h index 8354668..0de41f5 100755 --- a/src/cmockery/cmockery.h +++ b/src/cmockery/cmockery.h @@ -140,7 +140,7 @@ cast_to_largest_integral_type(cast_to_pointer_integral_type(value)) */ #define expect_check(function, parameter, check_function, check_data)
_expect_check(#function, #parameter, FILE, LINE, check_function, \ -
cast_to_largest_integral_type(check_data), NULL, 0)
-
cast_to_largest_integral_type(check_data), NULL, 1)
/* Add an event to check a parameter, using check_expected(), against a set of
- values. See will_return() for a description of the count parameter.
Sorry about the messed up message before. I have now provided the patch in a pull-request (#30).