[Lemon-commits] [lemon_svn] athos: r3022 - hugo/trunk/test
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 21:51:54 CET 2006
Author: athos
Date: Fri Oct 27 14:39:13 2006
New Revision: 3022
Modified:
hugo/trunk/test/lp_test.cc
Log:
A little test was born for Expr::simplify().
Modified: hugo/trunk/test/lp_test.cc
==============================================================================
--- hugo/trunk/test/lp_test.cc (original)
+++ hugo/trunk/test/lp_test.cc Fri Oct 27 14:39:13 2006
@@ -19,7 +19,7 @@
#include <sstream>
#include <lemon/lp_skeleton.h>
#include "test_tools.h"
-
+#include <lemon/tolerance.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -175,6 +175,37 @@
lp.addRow(x[1]+x[3]<=x[5]-3);
lp.addRow(-7<=x[1]+x[3]-12<=3);
lp.addRow(x[1]<=x[5]);
+
+ std::ostringstream buf;
+
+
+ //Checking the simplify function
+
+// //How to check the simplify function? A map gives no information
+// //on the question whether a given key is or is not stored in it, or
+// //it does?
+// Yes, it does, using the find() function.
+ e=((p1+p2)+(p1-p2));
+ e.simplify();
+ buf << "Coeff. of p2 should be 0";
+ // std::cout<<e[p1]<<e[p2]<<e[p3]<<std::endl;
+ check(e.find(p2)==e.end(), buf.str());
+
+
+
+
+ e=((p1+p2)+(p1-0.99*p2));
+ double tolerance=0.001;
+ e.simplify(tolerance);
+ buf << "Coeff. of p2 should be 0.01";
+ check(e[p2]>0, buf.str());
+
+ tolerance=0.02;
+ e.simplify(tolerance);
+ buf << "Coeff. of p2 should be 0";
+ check(e.find(p2)==e.end(), buf.str());
+
+
}
{
More information about the Lemon-commits
mailing list