ReactOS 0.4.15-dev-8219-ge8b88cf
ForeachTest Class Reference
Inheritance diagram for ForeachTest:
Collaboration diagram for ForeachTest:

Protected Member Functions

void foreach0 ()
 
void foreach1 ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (ForeachTest)
 
 CPPUNIT_TEST (foreach0)
 
 CPPUNIT_TEST (foreach1)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 14 of file foreach_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/2]

ForeachTest::CPPUNIT_TEST ( foreach0  )
private

◆ CPPUNIT_TEST() [2/2]

ForeachTest::CPPUNIT_TEST ( foreach1  )
private

◆ CPPUNIT_TEST_SUITE()

ForeachTest::CPPUNIT_TEST_SUITE ( ForeachTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

ForeachTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ foreach0()

void ForeachTest::foreach0 ( )
protected

Definition at line 35 of file foreach_test.cpp.

36{
37 int numbers[10] = { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 };
38
39 for_each(numbers, numbers + 10, ptr_fun(increase));
40
41 CPPUNIT_ASSERT(numbers[0]==2);
42 CPPUNIT_ASSERT(numbers[1]==2);
43 CPPUNIT_ASSERT(numbers[2]==3);
44 CPPUNIT_ASSERT(numbers[3]==4);
45 CPPUNIT_ASSERT(numbers[4]==6);
46 CPPUNIT_ASSERT(numbers[5]==9);
47 CPPUNIT_ASSERT(numbers[6]==14);
48 CPPUNIT_ASSERT(numbers[7]==22);
49 CPPUNIT_ASSERT(numbers[8]==35);
50 CPPUNIT_ASSERT(numbers[9]==56);
51}
_STLP_BEGIN_NAMESPACE _STLP_INLINE_LOOP _Function for_each(_InputIter __first, _InputIter __last, _Function __f)
Definition: _algo.h:59
pointer_to_unary_function< _Arg, _Result > ptr_fun(_Result(*__f)(_Arg))
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
static void increase(int &a_)

◆ foreach1()

void ForeachTest::foreach1 ( )
protected

Definition at line 56 of file foreach_test.cpp.

57{
58 vector<int> v1(10);
59 for (int i = 0; (size_t)i < v1.size(); ++i)
60 v1[i] = i;
61 for_each(v1.begin(), v1.end(), ptr_fun(sqr) );
62
63 CPPUNIT_ASSERT(v1[0]==0);
64 CPPUNIT_ASSERT(v1[1]==1);
65 CPPUNIT_ASSERT(v1[2]==4);
66 CPPUNIT_ASSERT(v1[3]==9);
67 CPPUNIT_ASSERT(v1[4]==16);
68 CPPUNIT_ASSERT(v1[5]==25);
69 CPPUNIT_ASSERT(v1[6]==36);
70 CPPUNIT_ASSERT(v1[7]==49);
71 CPPUNIT_ASSERT(v1[8]==64);
72 CPPUNIT_ASSERT(v1[9]==81);
73}
__kernel_size_t size_t
Definition: linux.h:237
static void sqr(int &a_)
GLfloat GLfloat v1
Definition: glext.h:6062
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 i
Definition: glfuncs.h:248

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