home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl453up.zip / stl453fx / test / eh / test_assign_op.h < prev    next >
C/C++ Source or Header  |  2002-04-29  |  1KB  |  51 lines

  1. /***********************************************************************************
  2.     test_assign_op.h
  3.     
  4.         SUMMARY: Test functor template for assignment operators.
  5.  
  6.  * Copyright (c) 1997
  7.  * Mark of the Unicorn, Inc.
  8.  *
  9.  * Permission to use, copy, modify, distribute and sell this software
  10.  * and its documentation for any purpose is hereby granted without fee,
  11.  * provided that the above copyright notice appear in all copies and
  12.  * that both that copyright notice and this permission notice appear
  13.  * in supporting documentation.  Mark of the Unicorn makes no
  14.  * representations about the suitability of this software for any
  15.  * purpose.  It is provided "as is" without express or implied warranty.
  16.         
  17. ***********************************************************************************/
  18. #ifndef test_assign_op_H_
  19. #define test_assign_op_H_
  20.  
  21. # include "Prefix.h"
  22. # ifdef EH_NEW_HEADERS
  23. #  include <cassert>
  24. # else
  25. #  include <assert.h>
  26. # endif
  27. #include "nc_alloc.h"
  28.  
  29. template <class T>
  30. struct test_assign_op
  31. {
  32.     test_assign_op( const T& src )
  33.         : source(src)
  34.     {
  35.         gTestController.SetCurrentTestName("assignment operator");
  36.     }
  37.     
  38.     void operator()( T& t ) const
  39.     {
  40.         t = source;
  41.         
  42.         // Prevent simulated failures during verification
  43.         gTestController.CancelFailureCountdown();
  44.         EH_ASSERT( source == t );
  45.     }
  46. private:
  47.     const T& source;
  48. };
  49.  
  50. #endif // test_assign_op_H_
  51.