Ignore:
Timestamp:
Mar 13, 2014 2:09:41 PM (5 years ago)
Author:
mlubin
Message:

Allow passing arbitrary command-line parameters using the C interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/test/CInterfaceTest.c

    r2019 r2020  
    99#include <math.h>
    1010#include <stdio.h>
     11#include <string.h>
    1112
    1213
     
    3031    double rowub[] = {10};
    3132    const double *sol;
     33    const char* setname = "test model";
     34    char *getname = malloc(20);
    3235    int i;
    3336
     
    4447    Cbc_setObjSense(model, -1);
    4548    assert(Cbc_getObjSense(model) == -1);
     49
     50    Cbc_setProblemName(model, setname);
    4651
    4752    Cbc_solve(model);
     
    6368    assert(fabs(sol[3] - 1.0) < 1e-6);
    6469    assert(fabs(sol[4] - 1.0) < 1e-6);
     70
     71    Cbc_problemName(model, 20, getname);
     72    i = strcmp(getname,setname);
     73    assert( (i == 0) );
     74   
     75    Cbc_deleteModel(model);
    6576
    6677}
     
    95106    assert(!Cbc_isProvenOptimal(model));
    96107    assert(Cbc_isProvenInfeasible(model));
     108   
     109    Cbc_deleteModel(model);
    97110
    98111}
     
    122135    Cbc_setInteger(model, 0);
    123136
     137    Cbc_setParameter(model, "log", "0");
     138   
     139    printf("About to solve problem silently. You should see no output except \"Done\".\n");
    124140    Cbc_solve(model);
     141    printf("Done\n");
    125142   
    126143    assert(!Cbc_isProvenOptimal(model));
     
    128145    assert(Cbc_isContinuousUnbounded(model));
    129146
     147    Cbc_deleteModel(model);
    130148
    131149
Note: See TracChangeset for help on using the changeset viewer.