Closed antoinealb closed 10 years ago
Too generic. Please clarify. What do you define as "atomic calls" ? Mutex ? critical section ? another sync primitive? All of them?
Sorry, I meant a critical section.
For other sync primitives, I can already check for their usage using the acquired_count
field.
Given they're macros rather than proper functions working on a struct, I don't really know how to implement this in a meaningful way. Global variable in mock header doesn't seem appropriate because it would be shared between all critical sections being tested.
Will think about it but I'd be happy to hear your ideas.
A global variable could work, if we reset its state between each test, no ?
Another option I see would be to do it using a mock object and recording expectations. Not a huge fan of this because it makes the tests more fragile (you test the implementation not the behaviour).
I have a working implementation based on Cppumock. I will push it tomorrow after I reviewed it carefully.
fixed in #31 .
It would be useful to have a way to test if a function did some atomic calls and verify if they were polite enough to release the locks. For example :