Mailinglist Archive: zypp-commit (606 mails)

< Previous Next >
[zypp-commit] r9419 - in /trunk/libzypp: tests/zypp/PoolQuery_test.cc zypp/PoolQuery.cc
  • From: jkupec@xxxxxxxxxxxxxxxx
  • Date: Mon, 07 Apr 2008 11:30:06 -0000
  • Message-id: <20080407113006.9417726E97@xxxxxxxxxxxxxxxx>
Author: jkupec
Date: Mon Apr 7 13:30:06 2008
New Revision: 9419

URL: http://svn.opensuse.org/viewcvs/zypp?rev=9419&view=rev
Log:
- fix the ResultIterator stop rule
- +1 test

Modified:
trunk/libzypp/tests/zypp/PoolQuery_test.cc
trunk/libzypp/zypp/PoolQuery.cc

Modified: trunk/libzypp/tests/zypp/PoolQuery_test.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/PoolQuery_test.cc?rev=9419&r1=9418&r2=9419&view=diff
==============================================================================
--- trunk/libzypp/tests/zypp/PoolQuery_test.cc (original)
+++ trunk/libzypp/tests/zypp/PoolQuery_test.cc Mon Apr 7 13:30:06 2008
@@ -105,11 +105,7 @@
q.addAttribute(sat::SolvAttr::name, "zypper");
q.addRepo("zypp_svn");

- PoolQuery::ResultIterator it = q.begin();
- std::for_each(
- it,
- q.end(),
- &result_cb);
+ std::for_each(q.begin(), q.end(), &result_cb);
BOOST_CHECK(q.size() == 3);
}

@@ -145,8 +141,25 @@
BOOST_CHECK(q1.size() == 5);
}

+// match exact
BOOST_AUTO_TEST_CASE(pool_query_7)
{
+ cout << "****7****" << endl;
+ PoolQuery q;
+ q.addString("vim");
+ q.addAttribute(sat::SolvAttr::name);
+ q.setMatchExact();
+
+ std::for_each(q.begin(), q.end(), &result_cb);
+ BOOST_CHECK(q.size() == 3);
+
+ PoolQuery q1;
+ q1.addString("zypp");
+ q1.addAttribute(sat::SolvAttr::name);
+ q1.setMatchExact();
+
+ std::for_each(q1.begin(), q1.end(), &result_cb);
+ BOOST_CHECK(q1.empty());
}

BOOST_AUTO_TEST_CASE(pool_query_8)

Modified: trunk/libzypp/zypp/PoolQuery.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/PoolQuery.cc?rev=9419&r1=9418&r2=9419&view=diff
==============================================================================
--- trunk/libzypp/zypp/PoolQuery.cc (original)
+++ trunk/libzypp/zypp/PoolQuery.cc Mon Apr 7 13:30:06 2008
@@ -517,7 +517,8 @@
while (_has_next && !(got_match = matchSolvable()));
}

- if (!got_match)
+ // no more solvables and the last did not match
+ if (!got_match && !_has_next)
{
base_reference() = 0;
_sid = 0;
@@ -569,9 +570,11 @@
_sid = _rdit->solvid;
}
}
+ // no more attributes/solvables, return
else
{
- return matches;
+ // did the last solvable match conditions?
+ return matches && in_repo;
}
}
while (_rdit->solvid == _sid || !in_repo /*_sid < 2
*//*_rdit->repo->start*/);

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages