@@ -15,27 +15,26 @@ using namespace eiquadprog::solvers;
1515 * CI x + ci0 >= 0
1616 */
1717
18- BOOST_AUTO_TEST_SUITE ( BOOST_TEST_MODULE )
18+ BOOST_AUTO_TEST_SUITE ( BOOST_TEST_MODULE)
1919
2020// min ||x||^2
2121
22- BOOST_AUTO_TEST_CASE ( test_unbiased )
23- {
24- RtEiquadprog<2 ,0 ,0 > qp;
22+ BOOST_AUTO_TEST_CASE(test_unbiased) {
23+ RtEiquadprog<2 , 0 , 0 > qp;
2524
26- RtMatrixX<2 ,2 >::d Q;
25+ RtMatrixX<2 , 2 >::d Q;
2726 Q.setZero ();
28- Q (0 ,0 ) = 1.0 ;
29- Q (1 ,1 ) = 1.0 ;
27+ Q (0 , 0 ) = 1.0 ;
28+ Q (1 , 1 ) = 1.0 ;
3029
3130 RtVectorX<2 >::d C;
3231 C.setZero ();
3332
34- RtMatrixX<0 ,2 >::d Aeq;
33+ RtMatrixX<0 , 2 >::d Aeq;
3534
3635 RtVectorX<0 >::d Beq;
3736
38- RtMatrixX<0 ,2 >::d Aineq;
37+ RtMatrixX<0 , 2 >::d Aineq;
3938
4039 RtVectorX<0 >::d Bineq;
4140
@@ -50,19 +49,19 @@ BOOST_AUTO_TEST_CASE ( test_unbiased )
5049
5150 RtEiquadprog_status status = qp.solve_quadprog (Q, C, Aeq, Beq, Aineq, Bineq, x);
5251
53- BOOST_CHECK_EQUAL (status,expected);
52+ BOOST_CHECK_EQUAL (status, expected);
5453
55- BOOST_CHECK_CLOSE (qp.getObjValue (),val,1e-6 );
54+ BOOST_CHECK_CLOSE (qp.getObjValue (), val, 1e-6 );
5655
5756 BOOST_CHECK (x.isApprox (solution));
5857}
5958
6059// min ||x-x_0||^2, x_0 = (1 1)^T
6160
6261BOOST_AUTO_TEST_CASE (test_biased) {
63- RtEiquadprog<2 ,0 , 0 > qp;
62+ RtEiquadprog<2 , 0 , 0 > qp;
6463
65- RtMatrixX<2 ,2 >::d Q;
64+ RtMatrixX<2 , 2 >::d Q;
6665 Q.setZero ();
6766 Q (0 , 0 ) = 1.0 ;
6867 Q (1 , 1 ) = 1.0 ;
@@ -71,11 +70,11 @@ BOOST_AUTO_TEST_CASE(test_biased) {
7170 C (0 ) = -1 .;
7271 C (1 ) = -1 .;
7372
74- RtMatrixX<0 ,2 >::d Aeq;
73+ RtMatrixX<0 , 2 >::d Aeq;
7574
7675 RtVectorX<0 >::d Beq;
7776
78- RtMatrixX<0 ,2 >::d Aineq;
77+ RtMatrixX<0 , 2 >::d Aineq;
7978
8079 RtVectorX<0 >::d Bineq;
8180
@@ -103,24 +102,24 @@ BOOST_AUTO_TEST_CASE(test_biased) {
103102// x[1] = 1 - x[0]
104103
105104BOOST_AUTO_TEST_CASE (test_equality_constraints) {
106- RtEiquadprog<2 ,1 , 0 > qp;
105+ RtEiquadprog<2 , 1 , 0 > qp;
107106
108- RtMatrixX<2 ,2 >::d Q;
107+ RtMatrixX<2 , 2 >::d Q;
109108 Q.setZero ();
110109 Q (0 , 0 ) = 1.0 ;
111110 Q (1 , 1 ) = 1.0 ;
112111
113112 RtVectorX<2 >::d C;
114113 C.setZero ();
115114
116- RtMatrixX<1 ,2 >::d Aeq;
115+ RtMatrixX<1 , 2 >::d Aeq;
117116 Aeq (0 , 0 ) = 1 .;
118117 Aeq (0 , 1 ) = 1 .;
119118
120119 RtVectorX<1 >::d Beq;
121120 Beq (0 ) = -1 .;
122121
123- RtMatrixX<0 ,2 >::d Aineq;
122+ RtMatrixX<0 , 2 >::d Aineq;
124123
125124 RtVectorX<0 >::d Bineq;
126125
@@ -148,21 +147,21 @@ BOOST_AUTO_TEST_CASE(test_equality_constraints) {
148147// x[i] >= 1
149148
150149BOOST_AUTO_TEST_CASE (test_inequality_constraints) {
151- RtEiquadprog<2 ,0 , 2 > qp;
150+ RtEiquadprog<2 , 0 , 2 > qp;
152151
153- RtMatrixX<2 ,2 >::d Q;
152+ RtMatrixX<2 , 2 >::d Q;
154153 Q.setZero ();
155154 Q (0 , 0 ) = 1.0 ;
156155 Q (1 , 1 ) = 1.0 ;
157156
158157 RtVectorX<2 >::d C;
159158 C.setZero ();
160159
161- RtMatrixX<0 ,2 >::d Aeq;
160+ RtMatrixX<0 , 2 >::d Aeq;
162161
163162 RtVectorX<0 >::d Beq (0 );
164163
165- RtMatrixX<2 ,2 >::d Aineq;
164+ RtMatrixX<2 , 2 >::d Aineq;
166165 Aineq.setZero ();
167166 Aineq (0 , 0 ) = 1 .;
168167 Aineq (1 , 1 ) = 1 .;
@@ -195,29 +194,28 @@ BOOST_AUTO_TEST_CASE(test_inequality_constraints) {
195194// x[1] = 5 - x[0]
196195// x[1] >= 3
197196
198- BOOST_AUTO_TEST_CASE ( test_full )
199- {
200- RtEiquadprog<2 ,1 ,1 > qp;
197+ BOOST_AUTO_TEST_CASE (test_full) {
198+ RtEiquadprog<2 , 1 , 1 > qp;
201199
202- RtMatrixX<2 ,2 >::d Q;
200+ RtMatrixX<2 , 2 >::d Q;
203201 Q.setZero ();
204- Q (0 ,0 ) = 1.0 ;
205- Q (1 ,1 ) = 1.0 ;
202+ Q (0 , 0 ) = 1.0 ;
203+ Q (1 , 1 ) = 1.0 ;
206204
207205 RtVectorX<2 >::d C;
208206 C (0 ) = -1 .;
209207 C (1 ) = -1 .;
210208
211- RtMatrixX<1 ,2 >::d Aeq;
212- Aeq (0 ,0 ) = 1 .;
213- Aeq (0 ,1 ) = 1 .;
209+ RtMatrixX<1 , 2 >::d Aeq;
210+ Aeq (0 , 0 ) = 1 .;
211+ Aeq (0 , 1 ) = 1 .;
214212
215213 RtVectorX<1 >::d Beq;
216214 Beq (0 ) = -5 .;
217215
218- RtMatrixX<1 ,2 >::d Aineq;
216+ RtMatrixX<1 , 2 >::d Aineq;
219217 Aineq.setZero ();
220- Aineq (0 ,1 ) = 1 .;
218+ Aineq (0 , 1 ) = 1 .;
221219
222220 RtVectorX<1 >::d Bineq;
223221 Bineq (0 ) = -3 .;
@@ -234,9 +232,9 @@ BOOST_AUTO_TEST_CASE ( test_full )
234232
235233 RtEiquadprog_status status = qp.solve_quadprog (Q, C, Aeq, Beq, Aineq, Bineq, x);
236234
237- BOOST_CHECK_EQUAL (status,expected);
235+ BOOST_CHECK_EQUAL (status, expected);
238236
239- BOOST_CHECK_CLOSE (qp.getObjValue (),val,1e-6 );
237+ BOOST_CHECK_CLOSE (qp.getObjValue (), val, 1e-6 );
240238
241239 BOOST_CHECK (x.isApprox (solution));
242240}
@@ -247,17 +245,17 @@ BOOST_AUTO_TEST_CASE ( test_full )
247245// x[0] = -1
248246
249247BOOST_AUTO_TEST_CASE (test_unfeasible_equalities) {
250- RtEiquadprog<2 ,2 , 0 > qp;
248+ RtEiquadprog<2 , 2 , 0 > qp;
251249
252- RtMatrixX<2 ,2 >::d Q;
250+ RtMatrixX<2 , 2 >::d Q;
253251 Q.setZero ();
254252 Q (0 , 0 ) = 1.0 ;
255253 Q (1 , 1 ) = 1.0 ;
256254
257255 RtVectorX<2 >::d C;
258256 C.setZero ();
259257
260- RtMatrixX<2 ,2 >::d Aeq;
258+ RtMatrixX<2 , 2 >::d Aeq;
261259 Aeq.setZero ();
262260 Aeq (0 , 0 ) = 1 .;
263261 Aeq (1 , 0 ) = 1 .;
@@ -266,7 +264,7 @@ BOOST_AUTO_TEST_CASE(test_unfeasible_equalities) {
266264 Beq (0 ) = -1 .;
267265 Beq (1 ) = 1 .;
268266
269- RtMatrixX<0 ,2 >::d Aineq;
267+ RtMatrixX<0 , 2 >::d Aineq;
270268
271269 RtVectorX<0 >::d Bineq;
272270
@@ -287,21 +285,21 @@ BOOST_AUTO_TEST_CASE(test_unfeasible_equalities) {
287285// correctly fails, but returns wrong error code
288286
289287BOOST_AUTO_TEST_CASE (test_unfeasible_inequalities) {
290- RtEiquadprog<2 ,0 , 2 > qp;
288+ RtEiquadprog<2 , 0 , 2 > qp;
291289
292- RtMatrixX<2 ,2 >::d Q;
290+ RtMatrixX<2 , 2 >::d Q;
293291 Q.setZero ();
294292 Q (0 , 0 ) = 1.0 ;
295293 Q (1 , 1 ) = 1.0 ;
296294
297295 RtVectorX<2 >::d C;
298296 C.setZero ();
299297
300- RtMatrixX<0 ,2 >::d Aeq;
298+ RtMatrixX<0 , 2 >::d Aeq;
301299
302300 RtVectorX<0 >::d Beq;
303301
304- RtMatrixX<2 ,2 >::d Aineq;
302+ RtMatrixX<2 , 2 >::d Aineq;
305303 Aineq.setZero ();
306304 Aineq (0 , 0 ) = 1 .;
307305 Aineq (1 , 0 ) = -1 .;
@@ -324,21 +322,21 @@ BOOST_AUTO_TEST_CASE(test_unfeasible_inequalities) {
324322// DOES NOT WORK!
325323
326324BOOST_AUTO_TEST_CASE (test_unbounded) {
327- RtEiquadprog<2 ,0 , 0 > qp;
325+ RtEiquadprog<2 , 0 , 0 > qp;
328326
329- RtMatrixX<2 ,2 >::d Q;
327+ RtMatrixX<2 , 2 >::d Q;
330328 Q.setZero ();
331329 Q (0 , 0 ) = -1.0 ;
332330 Q (1 , 1 ) = -1.0 ;
333331
334332 RtVectorX<2 >::d C;
335333 C.setZero ();
336334
337- RtMatrixX<0 ,2 >::d Aeq;
335+ RtMatrixX<0 , 2 >::d Aeq;
338336
339337 RtVectorX<0 >::d Beq;
340338
341- RtMatrixX<0 ,2 >::d Aineq;
339+ RtMatrixX<0 , 2 >::d Aineq;
342340
343341 RtVectorX<0 >::d Bineq;
344342
@@ -349,7 +347,7 @@ BOOST_AUTO_TEST_CASE(test_unbounded) {
349347 RtEiquadprog_status status = qp.solve_quadprog (Q, C, Aeq, Beq, Aineq, Bineq, x);
350348
351349 BOOST_WARN_EQUAL (status, expected);
352- BOOST_WARN (status != RT_EIQUADPROG_OPTIMAL); // SHOULD pass!
350+ BOOST_WARN (status != RT_EIQUADPROG_OPTIMAL); // SHOULD pass!
353351}
354352
355353// min -||x||^2
@@ -359,21 +357,21 @@ BOOST_AUTO_TEST_CASE(test_unbounded) {
359357// DOES NOT WORK!
360358
361359BOOST_AUTO_TEST_CASE (test_nonconvex) {
362- RtEiquadprog<2 ,0 , 4 > qp;
360+ RtEiquadprog<2 , 0 , 4 > qp;
363361
364- RtMatrixX<2 ,2 >::d Q;
362+ RtMatrixX<2 , 2 >::d Q;
365363 Q.setZero ();
366364 Q (0 , 0 ) = -1.0 ;
367365 Q (1 , 1 ) = -1.0 ;
368366
369367 RtVectorX<2 >::d C;
370368 C.setZero ();
371369
372- RtMatrixX<0 ,2 >::d Aeq;
370+ RtMatrixX<0 , 2 >::d Aeq;
373371
374372 RtVectorX<0 >::d Beq;
375373
376- RtMatrixX<4 ,2 >::d Aineq (4 , 2 );
374+ RtMatrixX<4 , 2 >::d Aineq (4 , 2 );
377375 Aineq.setZero ();
378376 Aineq (0 , 0 ) = 1 .;
379377 Aineq (1 , 0 ) = -1 .;
@@ -405,5 +403,4 @@ BOOST_AUTO_TEST_CASE(test_nonconvex) {
405403 BOOST_WARN (x.isApprox (solution));
406404}
407405
408- BOOST_AUTO_TEST_SUITE_END ()
409-
406+ BOOST_AUTO_TEST_SUITE_END ()
0 commit comments