Sohail Somani writes:
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Matt Schuckmann
What I'd like to ask the Boost community about is this: how to go about unit testing private class methods.
Hi,
Rather than change the interface of my classes to use friend classes (I feel this unnecessarily clutters the interface)
I agree...
I do something simple and evil:
#define private public #define protected public # include "MyClass.hpp" #undef private #undef protected
Or something along those lines.
This is permissable in unit tests, I would think.
Yes, this is one of the alternate approaches I've been considering. We've got the "Bad" and the "Ugly". I'm still hoping the "Good" is out there somewhere... :-) ---------------------------------------------------------------------- Dave Steffen, Ph.D. Software Engineer IV Disobey this command! Numerica Corporation ph (970) 419-8343 x27 fax (970) 223-6797 - Douglas Hofstadter dgsteffen@numerica.us ___________________ Numerica Disclaimer: This message and any attachments are intended only for the individual or entity to which the message is addressed. It is proprietary and may contain privileged information. If you are neither the intended recipient nor the agent responsible for delivering the message to the intended recipient, you are hereby notified that any review, retransmission, dissemination, or taking of any action in reliance upon, the information in this communication is strictly prohibited, and may be unlawful. If you feel you have received this communication in error, please notify us immediately by returning this Email to the sender and deleting it from your computer.