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,812 of 33,346   
   =?UTF-8?Q?Tobias=20M=C3=BCller?= to Ian Collins   
   Re: Unit Testing Frameworks (was Re: Sin   
   23 Jan 13 23:23:17   
   
   -september.org> ddeaddf9   
   From: troplin@bluewin.ch   
      
   Ian Collins  wrote:   
   > I don't like making extra work for myself.  Maybe this stems form most   
   > of my work being one layer above the operating system APIs, so I end up   
   > mocking (often an automated process) a significant number of system   
   > libraries.   
   >   
   > I'm still waiting (but not holding my breath) for a real world example   
   > of why it's much easier to substitute the real code with the mock when   
   > using DI.   
      
   System calls are a good example. They are not really singletons, but the   
   same problems apply.   
      
   So consider a unit test with where malloc or new deliberately fails at some   
   point.   
   In the case of not using DI (read "Allocators") the unittest itself cannot   
   dynamically allocate memory without failing or having side effects on the   
   actual test.   
      
   Tobi   
      
      
   --   
         [ 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