[Lemon-commits] [lemon_svn] athos: r2038 - hugo/trunk/test

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:49:41 CET 2006


Author: athos
Date: Thu Jul  7 17:58:19 2005
New Revision: 2038

Modified:
   hugo/trunk/test/lp_test.cc

Log:
lp_test: error messages with appropriate status/value info


Modified: hugo/trunk/test/lp_test.cc
==============================================================================
--- hugo/trunk/test/lp_test.cc	(original)
+++ hugo/trunk/test/lp_test.cc	Thu Jul  7 17:58:19 2005
@@ -1,4 +1,5 @@
-#include<lemon/lp_skeleton.h>
+#include <sstream>
+#include <lemon/lp_skeleton.h>
 #include "test_tools.h"
 
 
@@ -184,16 +185,20 @@
 }
 
 void solveAndCheck(LpSolverBase& lp, LpSolverBase::SolutionStatus stat, 
-		   double exp_opt){
+		   double exp_opt) {
+  using std::string;
   lp.solve();
   //int decimal,sign;
-  std::string buf1;
+  std::ostringstream buf;
+  buf << "Primalstatus should be: " << int(stat);
+
   //  itoa(stat,buf1, 10);
-  check(lp.primalStatus()==stat,"Primalstatus should be "+buf1);
-    
-  if (stat ==  LpSolverBase::OPTIMAL){
-    check(std::abs(lp.primalValue()-exp_opt)<1e-3,
-	  "Wrong optimal value: the right optimum is ");
+  check(lp.primalStatus()==stat, buf.str());
+
+  if (stat ==  LpSolverBase::OPTIMAL) {
+    std::ostringstream buf;
+    buf << "Wrong optimal value: the right optimum is " << exp_opt; 
+    check(std::abs(lp.primalValue()-exp_opt) < 1e-3, buf.str());
     //+ecvt(exp_opt,2)
   }
 }



More information about the Lemon-commits mailing list