Re:Unit Testing in C++ and Objective-C just got easier
by phil_nash on Tuesday December 28, 2010 @08:55AM
(#2045438)
You make a good point and I have put in some workarounds for this already. I'll probably put more in over time.
The trade-off is that I didn't want to over-use expression templates so I have kept it to one level. But my aim is to at least allow arbitrary expressions to compile and correctly report failures. It should also detect when the expression cannot be decomposed and report this in the output so you can rewrite the expression if you do hit it. I have done this for some operators already.
Re:Unit Testing in C++ and Objective-C just got easier
by ot on Tuesday December 28, 2010 @09:06AM
(#2045457)
I want to say mine are nitpickings anyway, the library is very nice and I share your dislike for complex unit test libraries. I had to use the Boost Testing framework recently and that was a pain.
Don't know if it is relevant, but I think you can also work around the parentheses problem using some preprocessor magic. Boost Preprocessor does something similar in its handling of lists, but I haven't been using it for a very long time and I don't remember how it did the trick.
While very convenient it is kind of easy to "break". For example
the two checks are seemingly the same, but in the second case the trick doesn't work: Also, expressions not in the '<operand> <comparison operator> <operand>' form are not supported, for example causes this obscure error message Same for which fails with Not sure if these issues can cause real problems in everyday use, but they may cause headaches if one doesn't want to dig into preprocessor/template metaprogramming code.