On sábado, 24 de agosto de 2013 19:16:19, Till Oliver Knoll wrote:
> Ha! I /knew/ it! MS is totally not adhering to "the standard" *rant*
> *rant*...
> 
> Okay, you got me there, I never actually tried it myself, even though
> unit-testing private methods was also the first thing which came to my mind
> as being very useful when I learnt this Evil Trick here on qt-interest (I
> think).
> 
> The context was a similar one: trying pointer arithmetic, iterating over
> virtual function tables, casting... until someone just came up with this
> #define thing. At that time the simplicity and elegance just blew my mind -
> C++ rocks! It just gave me a rocket launcher to shot into my foot! ;)

The easiest way is to make your tester class a friend of the class, so it can 
call the privates.

But I'd argue this: why the hell do you need to test the privates? If no one 
can call them, you should be able to change them freely. You should test only 
the interface available to others.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to