micro-test-plus 3.2.0
µTest++, a lightweight testing framework for embedded platforms
Loading...
Searching...
No Matches
Functions vs. operators & literals

Which to use, functions like eq() or the overloaded operators? A very good question!

Functions guarantee that the nice feature of showing the actual values when expectations fail is always available. Also the syntax is more on the traditional side, and for some it may look simpler and easier to read.

Operators are generally easier to recognise than function calls, but require the hack with the type wrappers and literals to enforce the types, otherwise the actual values will not be displayed when the expectations fail.

Both syntaxes are functional, and, once the differences understood, the issue is a matter of personal preferences.

Note
The µOS++ projects favour explicit comparator functions.