ThrowTheSwitch / Ceedling

Ruby-based unit testing and build system for C projects
http://throwtheswitch.org
Other
584 stars 245 forks source link

Double pointer are not well managed in tests #603

Open AlexandreMarkus opened 3 years ago

AlexandreMarkus commented 3 years ago

I am trying to mock a function that uses a pointer pointer (**) for a 2d array. When I populate that 2d array, the mock function returns me wrong values. The function being tested uses different (random) values instead of the ones I init the array with. Is someone having similar issues?

mvandervoord commented 3 years ago

CMock doesn't yet support double-pointers, unfortunately. When you use it in this way, it's comparing the second layer of pointers instead of the things being pointed to. That makes for some cryptic errors and potential problems.

This is already on our list of things to improve upon.

Sorry for the inconvenience!

Mark

On Fri, Jun 11, 2021 at 8:39 AM AlexandreMarkus @.***> wrote:

I am trying to mock a function that uses a pointer pointer (**) for a 2d array. When I populate that 2d array, the mock function returns me wrong values. The function being tested uses different (random) values instead of the ones I init the array with. Is someone having similar issues?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ThrowTheSwitch/Ceedling/issues/603, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEA7ZWDKAMXXKK6LMIUITTSH7ZHANCNFSM46QU5UQQ .

AlexandreMarkus commented 3 years ago

CMock doesn't yet support double-pointers, unfortunately. When you use it in this way, it's comparing the second layer of pointers instead of the things being pointed to. That makes for some cryptic errors and potential problems. This is already on our list of things to improve upon. Sorry for the inconvenience! Mark On Fri, Jun 11, 2021 at 8:39 AM AlexandreMarkus @.*> wrote: I am trying to mock a function that uses a pointer pointer () for a 2d array. When I populate that 2d array, the mock function returns me wrong values. The function being tested uses different (random) values instead of the ones I init the array with. Is someone having similar issues? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#603>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEA7ZWDKAMXXKK6LMIUITTSH7ZHANCNFSM46QU5UQQ .

Thank you for your quick answer! I will try to test this function in a other way