-
Notifications
You must be signed in to change notification settings - Fork 984
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
Generic assertion #743
Comments
To allow myself to get sidetracked quickly... let's avoid saying things like "Practically (almost) every C compiler provide support for _generic"... particularly since it was only introduced in C11 and its use is sadly not widespread in the embedded space yet. The argumentative opener aside, this is a topic worth discussing. Do you envision that this generic assertion would attempt to identify the types involved and format the failures with the best formatting, or are you more interested in a more streamlined notation (instead of needing to remember/match all the assertion types)? If you don't care about the format of the error and only want to compare two values, you can already enable Or perhaps neither of these options is what you have in mind? |
I apologize for argumentative tone. I was trying to establish the case that for desktop/server, the _Generic feature is widely available. Ideally, implementation will be as you described - if the type is known, it should produce output based on the type. My "poor-man" implementation did not have the fallback to "any" type (like you described with UNITY_SHORTHAND). In the applications that I work with, we constantly have 2-5% failures on a large test suite. We will proceed with releasing code without 100% pass rate, based on human review of the failures - good formatting of error messages make a difference. For my use case (financial app) - If the _Generic version will handle int, bool, float and double (including arrays - int [], double [], ...) - it solve my problem. I assume other users might want to see the minimal implementation include additional types. Thanks for taking time to look at this issue. |
Thank you! This is a good idea and I appreciate you sharing it. We're wrapping up a release of Ceedling at the moment, but this is exactly the type of feature I'd like to introduce after that. |
Practically (almost) every C compiler provide support for _generic (with gcc/clang having additional features based on extensions). Would it be possible to implement a generic TEST-EQUAL that will get dispatched to the correct type-based test ?
Ideally, will support wide all atomic types, and therecarray variants.
For my test cases, 90% of assertion are for EQUAL, will make test cases more compact, and reduce time to write. Expecting build time errors if applied to unsupported type.
The text was updated successfully, but these errors were encountered: