-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to mock macros? #929
Comments
Macros are not mockable. Segmentation fault means you are accessing something that cannot be accessed in most cases which is a strange error to get from the target or simulator. You mock low level registers as variables in a way that you create a |
Here are some ideas towards working with registers: https://vandervoord.net/blog/2015/5/24/unit-test-how-registers To mock low-level API calls which are macros, you can perform a similar trick.
You never need to actually create the function in the top part. It provides a mockable interface for CMock to use. During release builds, the top portion is ignored and the macro is used. |
I am working on an IAR project. When my tests encounter micros accessing registers, segmentation fault will be raised. Are those macros mockable?
e.g.
stm32l4xx.h
source code file
test code file
The text was updated successfully, but these errors were encountered: