ReactOS  0.4.13-dev-242-g611e6d7
BindTest Class Reference
Inheritance diagram for BindTest:
Collaboration diagram for BindTest:

Protected Member Functions

void bind1st1 ()
 
void bind2nd1 ()
 
void bind2nd2 ()
 
void bind2nd3 ()
 
void bind_memfn ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (BindTest)
 
 CPPUNIT_TEST (bind1st1)
 
 CPPUNIT_TEST (bind2nd1)
 
 CPPUNIT_TEST (bind2nd2)
 
 CPPUNIT_TEST (bind2nd3)
 
 CPPUNIT_TEST (bind_memfn)
 
 CPPUNIT_TEST_SUITE_END ()
 

Private Attributes

 CPPUNIT_IGNORE
 

Detailed Description

Definition at line 13 of file bind_test.cpp.

Member Function Documentation

◆ bind1st1()

void BindTest::bind1st1 ( )
protected

Definition at line 53 of file bind_test.cpp.

54 {
55  int array [3] = { 1, 2, 3 };
56  int* p = remove_if((int*)array, (int*)array + 3, bind1st(less<int>(), 2));
57 
58  CPPUNIT_ASSERT(p == &array[2]);
59  CPPUNIT_ASSERT(array[0] == 1);
60  CPPUNIT_ASSERT(array[1] == 2);
61 
62  for_each((int*)array, (int*)array + 3, bind1st(pre_increment(), 1));
63  CPPUNIT_ASSERT(array[0] == 2);
64  CPPUNIT_ASSERT(array[1] == 3);
65  CPPUNIT_ASSERT(array[2] == 4);
66 
67  for_each((int*)array, (int*)array + 3, bind2nd(post_increment(), 1));
68  CPPUNIT_ASSERT(array[0] == 3);
69  CPPUNIT_ASSERT(array[1] == 4);
70  CPPUNIT_ASSERT(array[2] == 5);
71 }
binder2nd< _Operation > bind2nd(const _Operation &__fn, const _Tp &__x)
Definition: _function.h:252
binder1st< _Operation > bind1st(const _Operation &__fn, const _Tp &__x)
Definition: _function.h:217
_STLP_BEGIN_NAMESPACE _STLP_INLINE_LOOP _Function for_each(_InputIter __first, _InputIter __last, _Function __f)
Definition: _algo.h:59
_STLP_INLINE_LOOP _ForwardIter remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred)
Definition: _algo.h:278
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLfloat GLfloat p
Definition: glext.h:8902

◆ bind2nd1()

void BindTest::bind2nd1 ( )
protected

Definition at line 73 of file bind_test.cpp.

74 {
75  int array [3] = { 1, 2, 3 };
77 
78  CPPUNIT_ASSERT(array[0]==1);
79  CPPUNIT_ASSERT(array[1]==2);
80  CPPUNIT_ASSERT(array[2]==4);
81 }
_STLP_INLINE_LOOP void replace_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, const _Tp &__new_value)
Definition: _algo.h:190
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

◆ bind2nd2()

void BindTest::bind2nd2 ( )
protected

Definition at line 82 of file bind_test.cpp.

83 {
84  int array [3] = { 1, 2, 3 };
85  replace_if(array, array + 3, bind2nd(greater<int>(), 2), 4);
86  CPPUNIT_ASSERT(array[0]==1);
87  CPPUNIT_ASSERT(array[1]==2);
88  CPPUNIT_ASSERT(array[2]==4);
89 }
binder2nd< _Operation > bind2nd(const _Operation &__fn, const _Tp &__x)
Definition: _function.h:252
_STLP_INLINE_LOOP void replace_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, const _Tp &__new_value)
Definition: _algo.h:190
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200

◆ bind2nd3()

void BindTest::bind2nd3 ( )
protected

Definition at line 100 of file bind_test.cpp.

101 {
102 #if defined (STLPORT) && \
103  !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
104  int array[3] = { 1, 2, 3 };
107  CPPUNIT_ASSERT(array[0] == 1);
108  CPPUNIT_ASSERT(array[1] == 2);
109  CPPUNIT_ASSERT(array[2] == 3);
110 
112  CPPUNIT_ASSERT(array[0] == 21);
113  CPPUNIT_ASSERT(array[1] == 22);
114  CPPUNIT_ASSERT(array[2] == 23);
115 #endif
116 }
int test_func1(const int &param1, const int &param2)
Definition: bind_test.cpp:91
pointer_to_unary_function< _Arg, _Result > ptr_fun(_Result(*__f)(_Arg))
int test_func2(int &param1, int param2)
Definition: bind_test.cpp:95
binder2nd< _Operation > bind2nd(const _Operation &__fn, const _Tp &__x)
Definition: _function.h:252
binder1st< _Operation > bind1st(const _Operation &__fn, const _Tp &__x)
Definition: _function.h:217
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLuint GLenum GLenum transform
Definition: glext.h:9407

◆ bind_memfn()

void BindTest::bind_memfn ( )
protected

Definition at line 139 of file bind_test.cpp.

140 {
141 #if defined (STLPORT) && \
142  !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
143  A array[3];
144 
145  for_each( array, array + 3, bind2nd( mem_fun_ref(&A::f), 12 ) );
146 
147  CPPUNIT_CHECK( array[0].v() == 12 );
148 #endif
149 }
binder2nd< _Operation > bind2nd(const _Operation &__fn, const _Tp &__x)
Definition: _function.h:252
#define CPPUNIT_CHECK(X)
Definition: cppunit_mini.h:195
_STLP_BEGIN_NAMESPACE _STLP_INLINE_LOOP _Function for_each(_InputIter __first, _InputIter __last, _Function __f)
Definition: _algo.h:59
Definition: ttei1.cpp:12
mem_fun_ref_t< _Result, _Tp > mem_fun_ref(_Result(_Tp::*__f)())
const GLdouble * v
Definition: gl.h:2040
void f(int n) const
Definition: bind_test.cpp:124

◆ CPPUNIT_TEST() [1/5]

BindTest::CPPUNIT_TEST ( bind1st1  )
private

◆ CPPUNIT_TEST() [2/5]

BindTest::CPPUNIT_TEST ( bind2nd1  )
private

◆ CPPUNIT_TEST() [3/5]

BindTest::CPPUNIT_TEST ( bind2nd2  )
private

◆ CPPUNIT_TEST() [4/5]

BindTest::CPPUNIT_TEST ( bind2nd3  )
private

◆ CPPUNIT_TEST() [5/5]

BindTest::CPPUNIT_TEST ( bind_memfn  )
private

◆ CPPUNIT_TEST_SUITE()

BindTest::CPPUNIT_TEST_SUITE ( BindTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

BindTest::CPPUNIT_TEST_SUITE_END ( )
private

Member Data Documentation

◆ CPPUNIT_IGNORE

BindTest::CPPUNIT_IGNORE
private

Definition at line 21 of file bind_test.cpp.


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