chiark / gitweb /
added 9 more test functions
[nlopt.git] / test / testopt.cpp
index e2921ba588b735bd9db9703c3f43a72d56d76452..3599f51411a3f6f41451935a6b1b4df5b74ef4e9 100644 (file)
@@ -39,6 +39,7 @@ static int test_function(int ifunc)
   testfunc func;
   int i;
   double *x, fmin, f0;
+  nlopt_result ret;
   
   if (ifunc < 0 || ifunc >= NTESTFUNCS) {
     fprintf(stderr, "testopt: invalid function %d\n", ifunc);
@@ -78,12 +79,14 @@ static int test_function(int ifunc)
   }
 
   testfuncs_counter = 0;
-  if (nlopt_minimize(algorithm,
-                    func.n, func.f, func.f_data,
-                    func.lb, func.ub,
-                    x, &fmin,
-                    HUGE_VAL, ftol_rel, ftol_abs, xtol_rel, NULL,
-                    maxeval, maxtime) < 0) {
+  ret = nlopt_minimize(algorithm,
+                      func.n, func.f, func.f_data,
+                      func.lb, func.ub,
+                      x, &fmin,
+                      HUGE_VAL, ftol_rel, ftol_abs, xtol_rel, NULL,
+                      maxeval, maxtime);
+  printf("return code %d from nlopt_minimize\n", ret);
+  if (ret < 0) {
     fprintf(stderr, "testopt: error in nlopt_minimize\n");
     return 0;
   }