vberlier / narmock

A minimal mocking utility for C projects.
MIT License
6 stars 1 forks source link

Suggestion: call_count as int #4

Closed eerimoq closed 5 years ago

eerimoq commented 5 years ago

This is not a bug, but a suggestion.

I usually pass -Wextra to gcc, which makes

ASSERT_EQ(MOCK(mount)->call_count, 1);

give the compile error

main.c: In function ‘_narwhal_test_function_ml_mount_ok’:
/home/erik/workspace/monolinux/ml/tst/utils/narwhal.h:263:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     default: (left) == (right))

Replacing 1 with 1u obviously solves the problem, but I would prefer declaring call_count as int instead as it makes the code slightly easier to read and write.

vberlier commented 5 years ago

Yeah I had to work around it as well, changing it to an int definitely makes things cleaner. Just patched it in v0.2.6.