|
Boost Users : |
From: divyank shukla (divyank_s_at_[hidden])
Date: 2006-09-14 01:47:55
Most large softwares have test event drivers that
that allow some functions/interfaces be called only
for debug enviromnets. and in the code we have
constructs like
DBG_ASSERT()
regards
divyank
--- Scott Meyers <usenet_at_[hidden]> wrote:
> Rush Manbert wrote:
> > In a case like the example, where I know it might
> be hard to setup the
> > object correctly, I'd rather have a constructor
> that took some bogus
> > argument type that set the object up in "simulated
> success" mode, but
> > only in my debug build.
>
> I'm glad you mentioned this, because my recent
> knowledge of unit testing
> comes from books like Beck's "Test-Driven
> Development" and Feathers'
> "Working Effectively with Legacy Code" as well as
> countless breathless
> articles lauding the wonder of unit testing and
> showing how it's all
> oh-so-simple. My feeling is that it would often be
> convenient to have a
> special "test" interface, but I've never seen any
> discussion of doing
> that. I can imagine a couple of ways of doing this,
> one being to
> literally have a different interface for debug
> builds, another to have
> "test only" interface elements cordoned off
> somewhere by convention
> (similar to Boost's use of namespaces named
> "detail").
>
> > EventLog::EventLog (bool dummyarg)
> > { // This constructor sets us up in simulated
> success mode.
> > #ifdef DEBUG // or whatever you use
> > m_simulateSuccess = true;
> > #else
> > throw something useful
> > #endif
> > }
>
> Hmmm, I'd think this entire constructor would exist
> only in debug
> builds, e.g.,
>
> class EventLog {
> public:
> #ifdef DEBUG
> EventLog(bool dummyarg);
> #endif
>
> Unfortunately, conditional compilation is not
> without its own resultant
> spaghetti code and concomitant maintenance
> headaches.
>
> Scott
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
>
http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net