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 32,770 of 33,346   
   =?ISO-8859-1?Q?=D6=F6_Tiib?= to Balog Pal   
   Re: Unit Testing Frameworks (was Re: Sin   
   30 Dec 12 00:28:49   
   
   From: ootiib@hot.ee   
      
   On Friday, 28 December 2012 09:52:00 UTC+2, Balog Pal  wrote:   
   > On 12/27/2012 11:11 PM, Dave Abrahams wrote:   
   > > However, the use of a singleton may impede or prevent the logger   
   > > from being replaced for testing purposes, or prevent different   
   > > loggers from being used for individual tests.   
   >   
   > How? That is the claim I keep in the FUD category until someone cares   
   > to present the problem finally. Instead of just repeating "may".   
      
   There are *no* *way* how to prevent us from doing anything in typical   
   unit tests when testing single objects related to singleton.   
      
   There can be problems when testing the singletons themselves. We may   
   need to put each test into different executable to "reset" singleton   
   between tests. Or ... we may need some sort of special friend that has   
   access to its internals.   
      
   So ... our life is simpler if we use ordinary, non-copyable class   
   pattern instead of singleton pattern. To achieve singularity we can   
   have accessor to singular object that is decoupled from implementation   
   of the class or we can use global named object.   
      
      
   --   
         [ 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