ReactOS  0.4.15-dev-3291-gea4c1a0
test_stable_partition Struct Reference
Collaboration diagram for test_stable_partition:

Public Member Functions

 test_stable_partition (const SortBuffer &buf)
 
void operator() (SortBuffer &buf) const
 

Private Attributes

const SortBufferorig
 
SortClass partitionPoint
 

Detailed Description

Definition at line 85 of file test_algo.cpp.

Constructor & Destructor Documentation

◆ test_stable_partition()

test_stable_partition::test_stable_partition ( const SortBuffer buf)
inline

Definition at line 87 of file test_algo.cpp.

89  gTestController.SetCurrentTestName("stable_partition()");
90  }
SortClass partitionPoint
Definition: test_algo.cpp:136
TestController gTestController
Definition: nc_alloc.cpp:46
const SortBuffer & orig
Definition: test_algo.cpp:135
static void SetCurrentTestName(const char *str)
Definition: nc_alloc.h:172
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

Member Function Documentation

◆ operator()()

void test_stable_partition::operator() ( SortBuffer buf) const
inline

Definition at line 92 of file test_algo.cpp.

93  {
95 
96  SortClass* d = EH_STD::stable_partition( buf.begin(), buf.end(), throw_cmp );
97 
98  // Suppress warning about unused variable.
99  d;
100 
101  // If we get here no exception occurred during the operation.
102  // Stop any potential failures that might occur during verification.
104 
105  // Prepare an array of counts of the occurrence of each value in
106  // the legal range.
107  unsigned counts[SortClass::kRange];
108  EH_STD::fill_n( counts, (int)SortClass::kRange, 0 );
109  for ( const SortClass *q = orig.begin(); q != orig.end(); q++ )
110  counts[ q->value() ]++;
111 
113  for ( const SortClass* p = buf.begin(); p != buf.end(); p++ )
114  {
115  // Check that adjacent items with the same value haven't been
116  // reordered. This could be a more thorough test.
117  if ( p != buf.begin() && p->value() == p[-1].value() ) {
118  EH_ASSERT( p->GetAddress() > p[-1].GetAddress() );
119  }
120 
121  // Check that the partitioning worked.
122  EH_ASSERT( (p < d) == cmp( *p ) );
123 
124  // Decrement the appropriate count for each value.
125  counts[ p->value() ]--;
126  }
127 
128  // Check that the values were only rearranged, and none were lost.
129  for ( unsigned j = 0; j < SortClass::kRange; j++ ) {
130  EH_ASSERT( counts[j] == 0 );
131  }
132  }
SortClass partitionPoint
Definition: test_algo.cpp:136
TestController gTestController
Definition: nc_alloc.cpp:46
const SortBuffer & orig
Definition: test_algo.cpp:135
#define cmp(status, error)
Definition: error.c:114
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
#define EH_ASSERT
Definition: Prefix.h:37
_STLP_MOVE_TO_STD_NAMESPACE void fill_n(_OutputIter __first, _Size __n, const _Tp &__val)
Definition: _algobase.h:511
_STLP_MOVE_TO_STD_NAMESPACE _ForwardIter stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred)
Definition: _algo.c:866
SortClass * end()
Definition: test_algo.cpp:43
static void CancelFailureCountdown()
Definition: nc_alloc.h:143
GLfloat GLfloat p
Definition: glext.h:8902
SortClass * begin()
Definition: test_algo.cpp:41
#define d
Definition: ke_i.h:81

Member Data Documentation

◆ orig

const SortBuffer& test_stable_partition::orig
private

Definition at line 135 of file test_algo.cpp.

Referenced by operator()().

◆ partitionPoint

SortClass test_stable_partition::partitionPoint
private

Definition at line 136 of file test_algo.cpp.

Referenced by operator()().


The documentation for this struct was generated from the following file: