|
Boost Users : |
Subject: Re: [Boost-users] whitebox testing with boost unit test framework?
From: Chris Cleeland (chris.cleeland_at_[hidden])
Date: 2011-12-22 17:35:02
On Thu, Dec 22, 2011 at 3:05 PM, Mathias Gaunard
<mathias.gaunard_at_[hidden]> wrote:
> On 12/22/2011 12:25 AM, Chris Cleeland wrote:
>>
>> I'm using the boost unit test framework to implement unit tests for
>> code. I'm wondering if there is a best-practice for doing white-box
>> testing/internal state inspection of types under test. My hack right
>> now is to strip out "protected" and "private" from the header, but I
>> hold my nose as I do that.
>>
>> Thoughts/suggestions?
>>
>
> There are tricks to access private/protected members of a class without
> being a friend or anything like that.
>
> <http://bloglitb.blogspot.com/2010/07/access-to-private-members-thats-easy.html>
>
> Maybe that would be useful to you (haven't found a use for that yet)
That's a nifty, though convoluted, trick!
So far nothing I've tried has been as straightforward as #define private public
I do like the idea proposed in one of the comments on that blog where
somebody suggested having a public_cast<> operator to cast away
protections.
-- Chris Cleeland
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