00001 /*********************************************************************************** 00002 test_assign_op.h 00003 00004 SUMMARY: Test functor template for assignment operators. 00005 00006 * Copyright (c) 1997 00007 * Mark of the Unicorn, Inc. 00008 * 00009 * Permission to use, copy, modify, distribute and sell this software 00010 * and its documentation for any purpose is hereby granted without fee, 00011 * provided that the above copyright notice appear in all copies and 00012 * that both that copyright notice and this permission notice appear 00013 * in supporting documentation. Mark of the Unicorn makes no 00014 * representations about the suitability of this software for any 00015 * purpose. It is provided "as is" without express or implied warranty. 00016 00017 ***********************************************************************************/ 00018 #ifndef test_assign_op_H_ 00019 #define test_assign_op_H_ 00020 00021 # include "Prefix.h" 00022 # ifdef EH_NEW_HEADERS 00023 # include <cassert> 00024 # else 00025 # include <assert.h> 00026 # endif 00027 #include "nc_alloc.h" 00028 00029 template <class T> 00030 struct test_assign_op 00031 { 00032 test_assign_op( const T& src ) 00033 : source(src) 00034 { 00035 gTestController.SetCurrentTestName("assignment operator"); 00036 } 00037 00038 void operator()( T& t ) const 00039 { 00040 t = source; 00041 00042 // Prevent simulated failures during verification 00043 gTestController.CancelFailureCountdown(); 00044 EH_ASSERT( source == t ); 00045 } 00046 private: 00047 const T& source; 00048 }; 00049 00050 #endif // test_assign_op_H_