1 #include "ecos.h"
2 #include "minunit.h"
3 
4 static pfloat feas_Gx[2] = {1, -1};
5 static idxint feas_Gp[2] = {0, 2};
6 static idxint feas_Gi[2] = {0, 1};
7 
8 static pfloat feas_c[1] = {0};
9 static pfloat feas_h[2] = {1, 0};
10 
test_feas()11 static char * test_feas()
12 {
13     /**
14      * minimize 0
15      * s.t. 0 <= x <= 1
16      */
17     pwork *mywork;
18     idxint exitflag;
19 
20     /* set up data */
21     mywork = ECOS_setup(1, 2, 0,
22         2, 0, NULL, 0,
23         feas_Gx, feas_Gp, feas_Gi,
24         NULL, NULL, NULL,
25         feas_c, feas_h, NULL);
26 
27     if( mywork != NULL ){
28         /* solve */
29         exitflag = ECOS_solve(mywork);
30     }
31     else exitflag = ECOS_FATAL;
32 
33     /* clean up memory */
34     ECOS_cleanup(mywork, 0);
35 
36     mu_assert("feas-test: ECOS failed to produce outputflag OPTIMAL", exitflag == ECOS_OPTIMAL );
37     return 0;
38 }
39