Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expect_check() and expect_in_set() are broken #29

Open
zr5dt opened this issue May 19, 2015 · 1 comment
Open

expect_check() and expect_in_set() are broken #29

zr5dt opened this issue May 19, 2015 · 1 comment

Comments

@zr5dt
Copy link

zr5dt commented May 19, 2015

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.
@zr5dt
Copy link
Author

zr5dt commented May 20, 2015

Sorry about the messed up message before. I have now provided the patch in a pull-request (#30).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant