ReactOS 0.4.15-dev-7887-g64a59a1
PermTest Class Reference
Inheritance diagram for PermTest:
Collaboration diagram for PermTest:

Protected Member Functions

void nextprm0 ()
 
void nextprm1 ()
 
void nextprm2 ()
 
void prevprm0 ()
 
void prevprm1 ()
 
void prevprm2 ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (PermTest)
 
 CPPUNIT_TEST (nextprm0)
 
 CPPUNIT_TEST (nextprm1)
 
 CPPUNIT_TEST (nextprm2)
 
 CPPUNIT_TEST (prevprm0)
 
 CPPUNIT_TEST (prevprm1)
 
 CPPUNIT_TEST (prevprm2)
 
 CPPUNIT_TEST_SUITE_END ()
 

Detailed Description

Definition at line 17 of file perm_test.cpp.

Member Function Documentation

◆ CPPUNIT_TEST() [1/6]

PermTest::CPPUNIT_TEST ( nextprm0  )
private

◆ CPPUNIT_TEST() [2/6]

PermTest::CPPUNIT_TEST ( nextprm1  )
private

◆ CPPUNIT_TEST() [3/6]

PermTest::CPPUNIT_TEST ( nextprm2  )
private

◆ CPPUNIT_TEST() [4/6]

PermTest::CPPUNIT_TEST ( prevprm0  )
private

◆ CPPUNIT_TEST() [5/6]

PermTest::CPPUNIT_TEST ( prevprm1  )
private

◆ CPPUNIT_TEST() [6/6]

PermTest::CPPUNIT_TEST ( prevprm2  )
private

◆ CPPUNIT_TEST_SUITE()

PermTest::CPPUNIT_TEST_SUITE ( PermTest  )
private

◆ CPPUNIT_TEST_SUITE_END()

PermTest::CPPUNIT_TEST_SUITE_END ( )
private

◆ nextprm0()

void PermTest::nextprm0 ( )
protected

Definition at line 135 of file perm_test.cpp.

136{
137 int v1[3] = { 0, 1, 2 };
138 next_permutation(v1, v1 + 3);
139
140 CPPUNIT_ASSERT(v1[0]==0);
141 CPPUNIT_ASSERT(v1[1]==2);
142 CPPUNIT_ASSERT(v1[2]==1);
143}
_STLP_MOVE_TO_STD_NAMESPACE bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last)
Definition: _algo.c:1896
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLfloat GLfloat v1
Definition: glext.h:6062

◆ nextprm1()

void PermTest::nextprm1 ( )
protected

Definition at line 144 of file perm_test.cpp.

145{
146 vector <int> v1(3);
147 __iota(v1.begin(), v1.end(), 0);
148
149 next_permutation(v1.begin(), v1.end());
150 CPPUNIT_ASSERT(v1[0]==0);
151 CPPUNIT_ASSERT(v1[1]==2);
152 CPPUNIT_ASSERT(v1[2]==1);
153 next_permutation(v1.begin(), v1.end());
154 CPPUNIT_ASSERT(v1[0]==1);
155 CPPUNIT_ASSERT(v1[1]==0);
156 CPPUNIT_ASSERT(v1[2]==2);
157 next_permutation(v1.begin(), v1.end());
158 CPPUNIT_ASSERT(v1[0]==1);
159 CPPUNIT_ASSERT(v1[1]==2);
160 CPPUNIT_ASSERT(v1[2]==0);
161 next_permutation(v1.begin(), v1.end());
162 CPPUNIT_ASSERT(v1[0]==2);
163 CPPUNIT_ASSERT(v1[1]==0);
164 CPPUNIT_ASSERT(v1[2]==1);
165 next_permutation(v1.begin(), v1.end());
166 CPPUNIT_ASSERT(v1[0]==2);
167 CPPUNIT_ASSERT(v1[1]==1);
168 CPPUNIT_ASSERT(v1[2]==0);
169 next_permutation(v1.begin(), v1.end());
170 CPPUNIT_ASSERT(v1[0]==0);
171 CPPUNIT_ASSERT(v1[1]==1);
172 CPPUNIT_ASSERT(v1[2]==2);
173 next_permutation(v1.begin(), v1.end());
174 CPPUNIT_ASSERT(v1[0]==0);
175 CPPUNIT_ASSERT(v1[1]==2);
176 CPPUNIT_ASSERT(v1[2]==1);
177 next_permutation(v1.begin(), v1.end());
178 CPPUNIT_ASSERT(v1[0]==1);
179 CPPUNIT_ASSERT(v1[1]==0);
180 CPPUNIT_ASSERT(v1[2]==2);
181 next_permutation(v1.begin(), v1.end());
182 CPPUNIT_ASSERT(v1[0]==1);
183 CPPUNIT_ASSERT(v1[1]==2);
184 CPPUNIT_ASSERT(v1[2]==0);
185}
void __iota(_It __first, _It __last, _Tp __val)
Definition: iota.h:8

◆ nextprm2()

void PermTest::nextprm2 ( )
protected

Definition at line 186 of file perm_test.cpp.

187{
188 vector <char> v1(3);
189 __iota(v1.begin(), v1.end(), 'A');
190
191 next_permutation(v1.begin(), v1.end(), less<char>());
192 CPPUNIT_ASSERT(v1[0]=='A');
193 CPPUNIT_ASSERT(v1[1]=='C');
194 CPPUNIT_ASSERT(v1[2]=='B');
195 next_permutation(v1.begin(), v1.end(), less<char>());
196 CPPUNIT_ASSERT(v1[0]=='B');
197 CPPUNIT_ASSERT(v1[1]=='A');
198 CPPUNIT_ASSERT(v1[2]=='C');
199 next_permutation(v1.begin(), v1.end(), less<char>());
200 CPPUNIT_ASSERT(v1[0]=='B');
201 CPPUNIT_ASSERT(v1[1]=='C');
202 CPPUNIT_ASSERT(v1[2]=='A');
203 next_permutation(v1.begin(), v1.end(), less<char>());
204 CPPUNIT_ASSERT(v1[0]=='C');
205 CPPUNIT_ASSERT(v1[1]=='A');
206 CPPUNIT_ASSERT(v1[2]=='B');
207 next_permutation(v1.begin(), v1.end(), less<char>());
208 CPPUNIT_ASSERT(v1[0]=='C');
209 CPPUNIT_ASSERT(v1[1]=='B');
210 CPPUNIT_ASSERT(v1[2]=='A');
211 next_permutation(v1.begin(), v1.end(), less<char>());
212 CPPUNIT_ASSERT(v1[0]=='A');
213 CPPUNIT_ASSERT(v1[1]=='B');
214 CPPUNIT_ASSERT(v1[2]=='C');
215 next_permutation(v1.begin(), v1.end(), less<char>());
216 CPPUNIT_ASSERT(v1[0]=='A');
217 CPPUNIT_ASSERT(v1[1]=='C');
218 CPPUNIT_ASSERT(v1[2]=='B');
219 next_permutation(v1.begin(), v1.end(), less<char>());
220 CPPUNIT_ASSERT(v1[0]=='B');
221 CPPUNIT_ASSERT(v1[1]=='A');
222 CPPUNIT_ASSERT(v1[2]=='C');
223 next_permutation(v1.begin(), v1.end(), less<char>());
224 CPPUNIT_ASSERT(v1[0]=='B');
225 CPPUNIT_ASSERT(v1[1]=='C');
226 CPPUNIT_ASSERT(v1[2]=='A');
227
228}

◆ prevprm0()

void PermTest::prevprm0 ( )
protected

Definition at line 42 of file perm_test.cpp.

43{
44 int v1[3] = { 0, 1, 2 };
46
47 CPPUNIT_ASSERT(v1[0]==2);
48 CPPUNIT_ASSERT(v1[1]==1);
49 CPPUNIT_ASSERT(v1[2]==0);
50}
_STLP_MOVE_TO_STD_NAMESPACE bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last)
Definition: _algo.c:1947

◆ prevprm1()

void PermTest::prevprm1 ( )
protected

Definition at line 51 of file perm_test.cpp.

52{
53 vector <int> v1(3);
54 __iota(v1.begin(), v1.end(), 0);
55
56 prev_permutation(v1.begin(), v1.end());
57 CPPUNIT_ASSERT(v1[0]==2);
58 CPPUNIT_ASSERT(v1[1]==1);
59 CPPUNIT_ASSERT(v1[2]==0);
60 prev_permutation(v1.begin(), v1.end());
61 CPPUNIT_ASSERT(v1[0]==2);
62 CPPUNIT_ASSERT(v1[1]==0);
63 CPPUNIT_ASSERT(v1[2]==1);
64 prev_permutation(v1.begin(), v1.end());
65 CPPUNIT_ASSERT(v1[0]==1);
66 CPPUNIT_ASSERT(v1[1]==2);
67 CPPUNIT_ASSERT(v1[2]==0);
68 prev_permutation(v1.begin(), v1.end());
69 CPPUNIT_ASSERT(v1[0]==1);
70 CPPUNIT_ASSERT(v1[1]==0);
71 CPPUNIT_ASSERT(v1[2]==2);
72 prev_permutation(v1.begin(), v1.end());
73 CPPUNIT_ASSERT(v1[0]==0);
74 CPPUNIT_ASSERT(v1[1]==2);//
75 CPPUNIT_ASSERT(v1[2]==1);
76 prev_permutation(v1.begin(), v1.end());
77 CPPUNIT_ASSERT(v1[0]==0);
78 CPPUNIT_ASSERT(v1[1]==1);
79 CPPUNIT_ASSERT(v1[2]==2);
80 prev_permutation(v1.begin(), v1.end());
81 CPPUNIT_ASSERT(v1[0]==2);
82 CPPUNIT_ASSERT(v1[1]==1);
83 CPPUNIT_ASSERT(v1[2]==0);
84 prev_permutation(v1.begin(), v1.end());
85 CPPUNIT_ASSERT(v1[0]==2);
86 CPPUNIT_ASSERT(v1[1]==0);
87 CPPUNIT_ASSERT(v1[2]==1);
88 prev_permutation(v1.begin(), v1.end());
89 CPPUNIT_ASSERT(v1[0]==1);
90 CPPUNIT_ASSERT(v1[1]==2);
91 CPPUNIT_ASSERT(v1[2]==0);
92}

◆ prevprm2()

void PermTest::prevprm2 ( )
protected

Definition at line 93 of file perm_test.cpp.

94{
95 vector <int> v1(3);
96 __iota(v1.begin(), v1.end(), 0);
97
98 prev_permutation(v1.begin(), v1.end(), greater<int>());
99 CPPUNIT_ASSERT(v1[0]==0);
100 CPPUNIT_ASSERT(v1[1]==2);
101 CPPUNIT_ASSERT(v1[2]==1);
102 prev_permutation(v1.begin(), v1.end(), greater<int>());
103 CPPUNIT_ASSERT(v1[0]==1);
104 CPPUNIT_ASSERT(v1[1]==0);
105 CPPUNIT_ASSERT(v1[2]==2);
106 prev_permutation(v1.begin(), v1.end(), greater<int>());
107 CPPUNIT_ASSERT(v1[0]==1);
108 CPPUNIT_ASSERT(v1[1]==2);
109 CPPUNIT_ASSERT(v1[2]==0);
110 prev_permutation(v1.begin(), v1.end(), greater<int>());
111 CPPUNIT_ASSERT(v1[0]==2);
112 CPPUNIT_ASSERT(v1[1]==0);
113 CPPUNIT_ASSERT(v1[2]==1);
114 prev_permutation(v1.begin(), v1.end(), greater<int>());
115 CPPUNIT_ASSERT(v1[0]==2);
116 CPPUNIT_ASSERT(v1[1]==1);
117 CPPUNIT_ASSERT(v1[2]==0);
118 prev_permutation(v1.begin(), v1.end(), greater<int>());
119 CPPUNIT_ASSERT(v1[0]==0);
120 CPPUNIT_ASSERT(v1[1]==1);
121 CPPUNIT_ASSERT(v1[2]==2);
122 prev_permutation(v1.begin(), v1.end(), greater<int>());
123 CPPUNIT_ASSERT(v1[0]==0);
124 CPPUNIT_ASSERT(v1[1]==2);
125 CPPUNIT_ASSERT(v1[2]==1);
126 prev_permutation(v1.begin(), v1.end(), greater<int>());
127 CPPUNIT_ASSERT(v1[0]==1);
128 CPPUNIT_ASSERT(v1[1]==0);
129 CPPUNIT_ASSERT(v1[2]==2);
130 prev_permutation(v1.begin(), v1.end(), greater<int>());
131 CPPUNIT_ASSERT(v1[0]==1);
132 CPPUNIT_ASSERT(v1[1]==2);
133 CPPUNIT_ASSERT(v1[2]==0);
134}

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