aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2007-08-07 13:06:11 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2007-08-07 13:06:11 +0000
commita64f67d422afb13a94d0dd8e2653a025ee046d82 (patch)
tree5ab659326ffd5b881b77c7ce41f68ddb5c45ba4e
parent79b75492801ea767af2c509dbcc626014932ad29 (diff)
downloadpaludis-a64f67d422afb13a94d0dd8e2653a025ee046d82.tar.gz
paludis-a64f67d422afb13a94d0dd8e2653a025ee046d82.tar.xz
Really fix.
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc72
1 files changed, 44 insertions, 28 deletions
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index a54e689..0b6464d 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -776,41 +776,57 @@ namespace test_cases
tr1::shared_ptr<ERepository> repo(make_ebuild_repository(&env, keys));
env.package_database()->add_repository(1, repo);
- tr1::shared_ptr<const RepositoryVirtualsInterface::VirtualsSequence> seq(repo->virtual_packages());
- RepositoryVirtualsInterface::VirtualsSequence::Iterator it(seq->begin());
-
- TEST_CHECK(seq->end() != it);
- TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name, "virtual/one");
- TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec, "cat-one/pkg-one");
- ++it;
+ bool has_one(false), has_two(false), has_three(false);
+ int count(0);
- TEST_CHECK(seq->end() != it);
- TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name, "virtual/two");
- TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec, "cat-two/pkg-two");
- ++it;
+ tr1::shared_ptr<const RepositoryVirtualsInterface::VirtualsSequence> seq(repo->virtual_packages());
+ for (RepositoryVirtualsInterface::VirtualsSequence::Iterator it(seq->begin()),
+ it_end(seq->end()); it_end != it; ++it, ++count)
+ if ("virtual/one" == stringify(it->virtual_name))
+ {
+ has_one = true;
+ TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec, "cat-one/pkg-one");
+ }
+ else
+ {
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name, "virtual/two");
+ has_two = true;
+ TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec, "cat-two/pkg-two");
+ }
- TEST_CHECK(seq->end() == it);
+ TEST_CHECK(has_one);
+ TEST_CHECK(has_two);
+ TEST_CHECK_EQUAL(count, 2);
repo->set_profile(repo->find_profile(repo->params().location / "profiles/profile/subprofile"));
- seq = repo->virtual_packages();
- it = seq->begin();
- TEST_CHECK(seq->end() != it);
- TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name, "virtual/one");
- TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec, "cat-two/pkg-two");
- ++it;
+ has_one = has_two = false;
+ count = 0;
- TEST_CHECK(seq->end() != it);
- TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name, "virtual/three");
- TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec, "cat-three/pkg-three");
- ++it;
-
- TEST_CHECK(seq->end() != it);
- TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name, "virtual/two");
- TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec, "cat-one/pkg-one");
- ++it;
+ seq = repo->virtual_packages();
+ for (RepositoryVirtualsInterface::VirtualsSequence::Iterator it(seq->begin()),
+ it_end(seq->end()); it_end != it; ++it, ++count)
+ if ("virtual/one" == stringify(it->virtual_name))
+ {
+ has_one = true;
+ TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec, "cat-two/pkg-two");
+ }
+ else if ("virtual/two" == stringify(it->virtual_name))
+ {
+ has_two = true;
+ TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec, "cat-one/pkg-one");
+ }
+ else
+ {
+ TEST_CHECK_STRINGIFY_EQUAL(it->virtual_name, "virtual/three");
+ has_three = true;
+ TEST_CHECK_STRINGIFY_EQUAL(*it->provided_by_spec, "cat-three/pkg-three");
+ }
- TEST_CHECK(seq->end() == it);
+ TEST_CHECK(has_one);
+ TEST_CHECK(has_two);
+ TEST_CHECK(has_three);
+ TEST_CHECK_EQUAL(count, 3);
}
} test_e_repository_virtuals;