chenjiancan / cmockery

Automatically exported from code.google.com/p/cmockery
0 stars 0 forks source link

value_in_set_display_error() falsely reports errors. #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When I call assert_in_set() with a value of '1' and an enumeration array as the 
set (0-12), I get the 
following error:
"1 is not in the set (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )"

Calling assert_in_set() will call value_in_set_display_error() with invert=0.
It looks like there's something wrong with the "invert" logic.
As soon as set[i] == value (e.g. 1 == 1), the 'for' loop breaks, but
then rather than return success, it prints the error message and
returns failure.

Original issue reported on code.google.com by debt...@gmail.com on 9 Jan 2009 at 8:21

GoogleCodeExporter commented 9 years ago
Here is a proposed fix to the function. I have just slightly changed the logic 
of
"invert". Everything seems to work well.

Original comment by debt...@gmail.com on 9 Jan 2009 at 8:44

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by stewarta...@gmail.com on 10 Apr 2009 at 9:42

GoogleCodeExporter commented 9 years ago

Original comment by stewarta...@gmail.com on 10 Apr 2009 at 9:44

GoogleCodeExporter commented 9 years ago
This will be integrated into cmockery release 0.1.3.

Original comment by stewarta...@gmail.com on 7 Jul 2009 at 7:50