RE: [Cppunit-devel] assert* macros, revisited
Brought to you by:
blep
From: Townsend, G. <gto...@sh...> - 2001-05-29 18:29:58
|
> On Fri, May 25, 2001 at 03:28PM -0700, Steve M. Robbins wrote: > > Doesn't matter to me, either. However, it would be nice if all macros > defined in CppUnit share the same prefix. As far as I can see, the > only other macros in CppUnit are prefixed by CU_ (CU_TEST_SUITE and > friends). Which really argues for assert() being changed to CU_ASSERT(). Since it's a macro, shouldn't it be all upper case. The compiler vendors get away with it because of the C library having two versions of many functions, but it's certainly standard practice for others to capitalize macros. (Microsoft has already stolen ASSERT() for MFC, so that is not a good choice either; besides the fact that a library like CppUnit should use its own prefix for anything in the global name space) > Ah. Sorry; I have been advocating a new macro "assertEqual", > > #define CU_assertEqual(expected,actual)\ > (CppUnit::TestAssert::assertEquals ((expected),\ > (actual),__LINE__,__FILE__)) > > and this is what I was referring to, not the member function > of TestAssert. > (Also, I'm suggesting that TestAssert::assertEquals() be a > templated function). I like that. (though the all caps for macros question comes up again). Making TestAssert::assertEquals() be a templated function sounds interesting. Gets around all the variations of that function. On the other hand I don't have anything useful to contribute to the discussion of compiler support, so other than "that sounds good (in theory)" I'll just watch to see how it works out. Guy |