1.1 --- a/test/lp_test.cc Thu Feb 26 09:39:02 2009 +0000
1.2 +++ b/test/lp_test.cc Thu Feb 26 07:39:16 2009 +0000
1.3 @@ -197,6 +197,11 @@
1.4 buf << "Coeff. of p2 should be 0";
1.5 check(const_cast<const LpSolver::Expr&>(e)[p2]==0, buf.str());
1.6
1.7 + //Test for clone/new
1.8 + LP* lpnew = lp.newSolver();
1.9 + LP* lpclone = lp.cloneSolver();
1.10 + delete lpnew;
1.11 + delete lpclone;
1.12
1.13 }
1.14
1.15 @@ -247,7 +252,8 @@
1.16
1.17 if (stat == LpSolver::OPTIMAL) {
1.18 std::ostringstream sbuf;
1.19 - sbuf << "Wrong optimal value: the right optimum is " << exp_opt;
1.20 + sbuf << "Wrong optimal value (" << lp.primal() <<") with "
1.21 + << lp.solverName() <<"\n the right optimum is " << exp_opt;
1.22 check(std::abs(lp.primal()-exp_opt) < 1e-3, sbuf.str());
1.23 }
1.24 }
1.25 @@ -355,6 +361,19 @@
1.26
1.27 }
1.28
1.29 +template<class LP>
1.30 +void cloneTest()
1.31 +{
1.32 + //Test for clone/new
1.33 +
1.34 + LP* lp = new LP();
1.35 + LP* lpnew = lp->newSolver();
1.36 + LP* lpclone = lp->cloneSolver();
1.37 + delete lp;
1.38 + delete lpnew;
1.39 + delete lpclone;
1.40 +}
1.41 +
1.42 int main()
1.43 {
1.44 LpSkeleton lp_skel;
1.45 @@ -365,6 +384,7 @@
1.46 GlpkLp lp_glpk1,lp_glpk2;
1.47 lpTest(lp_glpk1);
1.48 aTest(lp_glpk2);
1.49 + cloneTest<GlpkLp>();
1.50 }
1.51 #endif
1.52
1.53 @@ -381,6 +401,7 @@
1.54 std::cerr << "Cplex license check failed, lp check skipped" << std::endl;
1.55 #endif
1.56 }
1.57 + cloneTest<CplexLp>();
1.58 #endif
1.59
1.60 #ifdef HAVE_SOPLEX
1.61 @@ -388,6 +409,7 @@
1.62 SoplexLp lp_soplex1,lp_soplex2;
1.63 lpTest(lp_soplex1);
1.64 aTest(lp_soplex2);
1.65 + cloneTest<SoplexLp>();
1.66 }
1.67 #endif
1.68
1.69 @@ -396,6 +418,7 @@
1.70 ClpLp lp_clp1,lp_clp2;
1.71 lpTest(lp_clp1);
1.72 aTest(lp_clp2);
1.73 + cloneTest<ClpLp>();
1.74 }
1.75 #endif
1.76