Boost logo

Boost Users :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-09-15 12:43:39


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] 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 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.

Sohail


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