ReactOS  0.4.14-dev-368-gfa26425
Ptr2Test Class Reference
Inheritance diagram for Ptr2Test:
Collaboration diagram for Ptr2Test:

Protected Member Functions

void ptrbin1 ()
 
void ptrbin2 ()
 
void ptrun1 ()
 
void ptrun2 ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (Ptr2Test)
 
 CPPUNIT_TEST (ptrbin1)
 
 CPPUNIT_TEST (ptrbin2)
 
 CPPUNIT_TEST (ptrun1)
 
 CPPUNIT_TEST (ptrun2)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 14 of file ptr2_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/4]

Ptr2Test::CPPUNIT_TEST ( ptrbin1  )
private

◆ CPPUNIT_TEST() [2/4]

Ptr2Test::CPPUNIT_TEST ( ptrbin2  )
private

◆ CPPUNIT_TEST() [3/4]

Ptr2Test::CPPUNIT_TEST ( ptrun1  )
private

◆ CPPUNIT_TEST() [4/4]

Ptr2Test::CPPUNIT_TEST ( ptrun2  )
private

◆ CPPUNIT_TEST_SUITE()

Ptr2Test::CPPUNIT_TEST_SUITE ( Ptr2Test  )
private

◆ CPPUNIT_TEST_SUITE_END()

Ptr2Test::CPPUNIT_TEST_SUITE_END ( )
private

◆ ptrbin1()

void Ptr2Test::ptrbin1 ( )
protected

Definition at line 43 of file ptr2_test.cpp.

44 {
45  int input1 [4] = { 7, 2, 3, 5 };
46  int input2 [4] = { 1, 5, 5, 8 };
47 
48  int output [4];
49  transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, pointer_to_binary_function<int, int, int>(sum));
50 
51  CPPUNIT_ASSERT(output[0]==8);
52  CPPUNIT_ASSERT(output[1]==7);
53  CPPUNIT_ASSERT(output[2]==8);
54  CPPUNIT_ASSERT(output[3]==13);
55 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLuint GLenum GLenum transform
Definition: glext.h:9407

◆ ptrbin2()

void Ptr2Test::ptrbin2 ( )
protected

Definition at line 56 of file ptr2_test.cpp.

57 {
58  int input1 [4] = { 7, 2, 3, 5 };
59  int input2 [4] = { 1, 5, 5, 8 };
60 
61  int output [4];
62  transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, ptr_fun(sum));
63 
64  CPPUNIT_ASSERT(output[0]==8);
65  CPPUNIT_ASSERT(output[1]==7);
66  CPPUNIT_ASSERT(output[2]==8);
67  CPPUNIT_ASSERT(output[3]==13);
68 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
pointer_to_unary_function< _Arg, _Result > ptr_fun(_Result(*__f)(_Arg))
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLuint GLenum GLenum transform
Definition: glext.h:9407

◆ ptrun1()

void Ptr2Test::ptrun1 ( )
protected

Definition at line 69 of file ptr2_test.cpp.

70 {
71  int array [3] = { 1, 2, 3 };
72 
73  int* p = find_if((int*)array, (int*)array + 3, pointer_to_unary_function<int, bool>(even));
74  CPPUNIT_ASSERT(p != array+3);
75  CPPUNIT_ASSERT(*p==2);
76 }
_STLP_MOVE_TO_STD_NAMESPACE _InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred)
Definition: _algobase.c:214
bool even(int n_)
Definition: ptr2_test.cpp:39
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLfloat GLfloat p
Definition: glext.h:8902

◆ ptrun2()

void Ptr2Test::ptrun2 ( )
protected

Definition at line 77 of file ptr2_test.cpp.

78 {
79  int array [3] = { 1, 2, 3 };
80 
81  int* p = find_if((int*)array, (int*)array + 3, ptr_fun(even));
82  CPPUNIT_ASSERT(p != array+3);
83  CPPUNIT_ASSERT(*p==2);
84 }
pointer_to_unary_function< _Arg, _Result > ptr_fun(_Result(*__f)(_Arg))
_STLP_MOVE_TO_STD_NAMESPACE _InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred)
Definition: _algobase.c:214
bool even(int n_)
Definition: ptr2_test.cpp:39
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLfloat GLfloat p
Definition: glext.h:8902

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