Re: c++ class design: where to put debug purpose utility class?
> std::vector<item> getAllItems();
>
> private:
> vector<string> pathList;
I would typedef every template instantiation, partly because it's
self-documenting, and because declaring the instantiation point carefully can
avoid obscure bugs in template expansion.
> Given the above class, my unit test is to cover addSearchPath()
What is the effect the added search path will have on other, external objects?
Recall this is not "unit" testing - you are allowed to use more than one object
at a time!
, so
> I can do either of the followings:
> 1. Just use the 2 public functions since they are the real API that
> customer code will use.
> 2. Unit test code accesses the private data directly to verify
> addSearchPath().
3 - detect the effect the added search path will have on behavior.
> I guess James Kanze would suggest #1, but for my case I lean to #2.
He is discussing unit testing, not TDD...
|