1.1 --- a/test/lp_test.cc Fri Feb 03 05:55:39 2012 +0100
1.2 +++ b/test/lp_test.cc Sun May 06 17:18:39 2012 +0200
1.3 @@ -41,11 +41,38 @@
1.4
1.5 using namespace lemon;
1.6
1.7 +int countCols(LpBase & lp) {
1.8 + int count=0;
1.9 + for (LpBase::ColIt c(lp); c!=INVALID; ++c) ++count;
1.10 + return count;
1.11 +}
1.12 +
1.13 +int countRows(LpBase & lp) {
1.14 + int count=0;
1.15 + for (LpBase::RowIt r(lp); r!=INVALID; ++r) ++count;
1.16 + return count;
1.17 +}
1.18 +
1.19 +
1.20 void lpTest(LpSolver& lp)
1.21 {
1.22
1.23 typedef LpSolver LP;
1.24
1.25 + // Test LpBase::clear()
1.26 + check(countRows(lp)==0, "Wrong number of rows");
1.27 + check(countCols(lp)==0, "Wrong number of cols");
1.28 + lp.addCol(); lp.addRow(); lp.addRow();
1.29 + check(countRows(lp)==2, "Wrong number of rows");
1.30 + check(countCols(lp)==1, "Wrong number of cols");
1.31 + lp.clear();
1.32 + check(countRows(lp)==0, "Wrong number of rows");
1.33 + check(countCols(lp)==0, "Wrong number of cols");
1.34 + lp.addCol(); lp.addCol(); lp.addCol(); lp.addRow();
1.35 + check(countRows(lp)==1, "Wrong number of rows");
1.36 + check(countCols(lp)==3, "Wrong number of cols");
1.37 + lp.clear();
1.38 +
1.39 std::vector<LP::Col> x(10);
1.40 // for(int i=0;i<10;i++) x.push_back(lp.addCol());
1.41 lp.addColSet(x);