ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

test_construct.h
Go to the documentation of this file.
00001 /***********************************************************************************
00002   test_construct.h
00003 
00004  * Copyright (c) 1997
00005  * Mark of the Unicorn, Inc.
00006  *
00007  * Permission to use, copy, modify, distribute and sell this software
00008  * and its documentation for any purpose is hereby granted without fee,
00009  * provided that the above copyright notice appear in all copies and
00010  * that both that copyright notice and this permission notice appear
00011  * in supporting documentation.  Mark of the Unicorn makes no
00012  * representations about the suitability of this software for any
00013  * purpose.  It is provided "as is" without express or implied warranty.
00014 
00015 ***********************************************************************************/
00016 #ifndef test_construct_H_
00017 #define test_construct_H_
00018 
00019 #include "Prefix.h"
00020 #if defined (EH_NEW_HEADERS)
00021 #  include <algorithm>
00022 #  include <cassert>
00023 #  include <cstdlib>
00024 #else
00025 #  include <algo.h>
00026 #  include <assert.h>
00027 #  include <stdlib.h>
00028 #endif
00029 
00030 USING_CSTD_NAME(size_t)
00031 
00032 template <class T>
00033 struct test_copy_construct {
00034   test_copy_construct() {
00035     gTestController.SetCurrentTestName("copy constructor");
00036   }
00037 
00038   void operator()( const T& t ) const {
00039     T aCopy( t );
00040     // Prevent simulated failures during verification
00041     gTestController.CancelFailureCountdown();
00042     //EH_ASSERT( aCopy == t );
00043     CheckInvariant(t);
00044   }
00045 };
00046 
00047 template <class T>
00048 struct test_default_construct {
00049   test_default_construct() {
00050     gTestController.SetCurrentTestName("default constructor");
00051   }
00052 
00053   void operator()( int ) const {
00054     T t;
00055     CheckInvariant(t);
00056   }
00057 };
00058 
00059 template <class T>
00060 struct test_construct_n {
00061   test_construct_n( size_t _n ) : n(_n+1) {
00062     gTestController.SetCurrentTestName("n-size constructor");
00063   }
00064 
00065   void operator()( int ) const {
00066     T t(n);
00067     CheckInvariant(t);
00068   }
00069 
00070   size_t n;
00071 };
00072 
00073 template <class T>
00074 struct test_construct_n_instance {
00075   test_construct_n_instance( size_t _n ) : n(_n+1) {
00076     gTestController.SetCurrentTestName("n-size with instance constructor");
00077   }
00078 
00079   void operator()( int ) const {
00080     typedef typename T::value_type Value_type;
00081     Value_type Val = 0;
00082     T t( n, Val );
00083     CheckInvariant(t);
00084   }
00085 
00086   size_t n;
00087 };
00088 
00089 template <class T>
00090 struct test_construct_pointer_range {
00091   test_construct_pointer_range( const typename T::value_type *first,
00092                                 const typename T::value_type* last )
00093     : fItems( first ), fEnd( last ) {
00094     gTestController.SetCurrentTestName("pointer range constructor");
00095   }
00096 
00097   void operator()( int ) const {
00098     T t( fItems, fEnd );
00099     // Prevent simulated failures during verification
00100     gTestController.CancelFailureCountdown();
00101     CheckInvariant(t);
00102   }
00103 
00104   const typename T::value_type* fItems, *fEnd;
00105 };
00106 
00107 template <class T>
00108 struct test_construct_iter_range {
00109 
00110   test_construct_iter_range( const T& src ) : fItems( src ) {
00111     gTestController.SetCurrentTestName("iterator range constructor");
00112   }
00113 
00114   void operator()( int ) const {
00115     T t( fItems.begin(), fItems.end() );
00116     // Prevent simulated failures during verification
00117     gTestController.CancelFailureCountdown();
00118     EH_ASSERT( t == fItems );
00119     CheckInvariant(t);
00120   }
00121 
00122   const T& fItems;
00123 };
00124 
00125 #endif // test_construct_H_

Generated on Sat May 26 2012 04:34:05 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.