google / cmockery

A lightweight library to simplify and generalize the process of writing unit tests for C applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cast_to_largest_integral_type truncate a 64bit value to 32bit

CoolVenkee opened this issue · comments

When I try to call will_return with a pointer paremeter on a 64bit linux platform. mock fucntion return another value which losses the high 32bit of the origin value.
int customer_ids = 543; will_return(mock_query_database, &customer_ids);
*results = (void**)mock();
&customer_ids = 0x7ffe38d150cc
but mock() = 0x38d150cc

finally, I modify the source code in cmockery.h, remove ‘unsiged’ in
#define cast_to_largest_integral_type(value) \ ((LargestIntegralType)((unsigned)value))
it works.

Yes, I have the same issue.