ReactOS 0.4.15-dev-8219-ge8b88cf
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 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
TestController gTestController
Definition: nc_alloc.cpp:46
static void SetCurrentTestName(const char *str)
Definition: nc_alloc.h:172
const SortBuffer & orig
Definition: test_algo.cpp:135
SortClass partitionPoint
Definition: test_algo.cpp:136

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 }
#define EH_ASSERT
Definition: Prefix.h:37
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat GLfloat p
Definition: glext.h:8902
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
#define d
Definition: ke_i.h:81
#define cmp(status, error)
Definition: error.c:114
SortClass * end()
Definition: test_algo.cpp:43
SortClass * begin()
Definition: test_algo.cpp:41
static void CancelFailureCountdown()
Definition: nc_alloc.h:143

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: