home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 33,178 of 33,346   
   Edward Diener to DeMarcus   
   Re: Is it a bad idea to define private:    
   25 Aug 13 18:58:35   
   
   From: eldiener@tropicsoft.invalid   
      
   On 8/25/2013 8:43 AM, DeMarcus wrote:   
   >   
   > Hi,   
   >   
   > In books about TDD I've seen various solutions to do White-Box   
   > testing, i.e. test the protected and private parts of classes.   
   >   
   > I came up with an idea that if you do the following it would be easy   
   > to test the internal parts of a class.   
   >   
   > #define protected public   
   > #define private public   
      
   Don't do that !   
      
   Testing the private functionality directly is a waste of time. There are   
   reasons why the functionality is marked 'private' and using private   
   functions only through the public and protected interfaces is one of them.   
      
   Testing the protected interface can be done through inheritance if need   
   be. Even here just test the public functions of whatever class inherits   
   from a class with protected functions.   
      
   Unit testing should test public functionality.   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca