COIN-OR::LEMON - Graph Library

Changeset 1543:a88ccf686a61 in lemon-0.x for test


Ignore:
Timestamp:
07/07/05 17:58:19 (14 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2038
Message:

lp_test: error messages with appropriate status/value info

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/lp_test.cc

    r1542 r1543  
    1 #include<lemon/lp_skeleton.h>
     1#include <sstream>
     2#include <lemon/lp_skeleton.h>
    23#include "test_tools.h"
    34
     
    185186
    186187void solveAndCheck(LpSolverBase& lp, LpSolverBase::SolutionStatus stat,
    187                    double exp_opt){
     188                   double exp_opt) {
     189  using std::string;
    188190  lp.solve();
    189191  //int decimal,sign;
    190   std::string buf1;
     192  std::ostringstream buf;
     193  buf << "Primalstatus should be: " << int(stat);
     194
    191195  //  itoa(stat,buf1, 10);
    192   check(lp.primalStatus()==stat,"Primalstatus should be "+buf1);
    193    
    194   if (stat ==  LpSolverBase::OPTIMAL){
    195     check(std::abs(lp.primalValue()-exp_opt)<1e-3,
    196           "Wrong optimal value: the right optimum is ");
     196  check(lp.primalStatus()==stat, buf.str());
     197
     198  if (stat ==  LpSolverBase::OPTIMAL) {
     199    std::ostringstream buf;
     200    buf << "Wrong optimal value: the right optimum is " << exp_opt;
     201    check(std::abs(lp.primalValue()-exp_opt) < 1e-3, buf.str());
    197202    //+ecvt(exp_opt,2)
    198203  }
Note: See TracChangeset for help on using the changeset viewer.