ReactOS 0.4.16-dev-197-g92996da
test_construct.h
Go to the documentation of this file.
1/***********************************************************************************
2 test_construct.h
3
4 * Copyright (c) 1997
5 * Mark of the Unicorn, Inc.
6 *
7 * Permission to use, copy, modify, distribute and sell this software
8 * and its documentation for any purpose is hereby granted without fee,
9 * provided that the above copyright notice appear in all copies and
10 * that both that copyright notice and this permission notice appear
11 * in supporting documentation. Mark of the Unicorn makes no
12 * representations about the suitability of this software for any
13 * purpose. It is provided "as is" without express or implied warranty.
14
15***********************************************************************************/
16#ifndef test_construct_H_
17#define test_construct_H_
18
19#include "Prefix.h"
20#if defined (EH_NEW_HEADERS)
21# include <algorithm>
22# include <cassert>
23# include <cstdlib>
24#else
25# include <algo.h>
26# include <assert.h>
27# include <stdlib.h>
28#endif
29
30USING_CSTD_NAME(size_t)
31
32template <class T>
35 gTestController.SetCurrentTestName("copy constructor");
36 }
37
38 void operator()( const T& t ) const {
39 T aCopy( t );
40 // Prevent simulated failures during verification
42 //EH_ASSERT( aCopy == t );
44 }
45};
46
47template <class T>
50 gTestController.SetCurrentTestName("default constructor");
51 }
52
53 void operator()( int ) const {
54 T t;
56 }
57};
58
59template <class T>
61 test_construct_n( size_t _n ) : n(_n+1) {
62 gTestController.SetCurrentTestName("n-size constructor");
63 }
64
65 void operator()( int ) const {
66 T t(n);
68 }
69
70 size_t n;
71};
72
73template <class T>
75 test_construct_n_instance( size_t _n ) : n(_n+1) {
76 gTestController.SetCurrentTestName("n-size with instance constructor");
77 }
78
79 void operator()( int ) const {
80 typedef typename T::value_type Value_type;
81 Value_type Val = 0;
82 T t( n, Val );
84 }
85
86 size_t n;
87};
88
89template <class T>
91 test_construct_pointer_range( const typename T::value_type *first,
92 const typename T::value_type* last )
93 : fItems( first ), fEnd( last ) {
94 gTestController.SetCurrentTestName("pointer range constructor");
95 }
96
97 void operator()( int ) const {
98 T t( fItems, fEnd );
99 // Prevent simulated failures during verification
102 }
103
104 const typename T::value_type* fItems, *fEnd;
105};
106
107template <class T>
109
111 gTestController.SetCurrentTestName("iterator range constructor");
112 }
113
114 void operator()( int ) const {
115 T t( fItems.begin(), fItems.end() );
116 // Prevent simulated failures during verification
118 EH_ASSERT( t == fItems );
120 }
121
122 const T& fItems;
123};
124
125#endif // test_construct_H_
EH_END_NAMESPACE void CheckInvariant(const C &)
Definition: LeakCheck.h:52
#define USING_CSTD_NAME(name)
Definition: Prefix.h:310
#define EH_ASSERT
Definition: Prefix.h:37
GLdouble GLdouble t
Definition: gl.h:2047
GLdouble n
Definition: glext.h:7729
GLenum src
Definition: glext.h:6340
const GLint * first
Definition: glext.h:5794
#define T
Definition: mbstring.h:31
static UINT UINT last
Definition: font.c:45
TestController gTestController
Definition: nc_alloc.cpp:46
static void SetCurrentTestName(const char *str)
Definition: nc_alloc.h:172
static void CancelFailureCountdown()
Definition: nc_alloc.h:143
test_construct_iter_range(const T &src)
void operator()(int) const
test_construct_n_instance(size_t _n)
void operator()(int) const
test_construct_n(size_t _n)
void operator()(int) const
const T::value_type * fEnd
const T::value_type * fItems
test_construct_pointer_range(const typename T::value_type *first, const typename T::value_type *last)
void operator()(const T &t) const
void operator()(int) const