aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-05 01:24:17 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-05 01:24:17 +0000
commit42b70d8dd57779d74a134b4a5df347521d3ddef9 (patch)
tree0f15e02b002d41512820ac8eea3e0e1b3fecd1ac
parentcf289dd30751a6f4729ae8d42a7077111657305c (diff)
downloadpaludis-42b70d8dd57779d74a134b4a5df347521d3ddef9.tar.gz
paludis-42b70d8dd57779d74a134b4a5df347521d3ddef9.tar.xz
Fix VDB repository tests
-rw-r--r--paludis/repositories/e/Makefile.am17
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc56
2 files changed, 43 insertions, 30 deletions
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index a7f6d2f..19d6e42 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -156,6 +156,20 @@ e_repository_TEST_LDADD = \
e_repository_TEST_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)
+vdb_repository_TEST_SOURCES = vdb_repository_TEST.cc
+
+vdb_repository_TEST_LDADD = \
+ libpaludiserepository.la \
+ $(top_builddir)/paludis/repositories/fake/libpaludisfakerepository.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
+vdb_repository_TEST_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)
+
vdb_merger_TEST_SOURCES = vdb_merger_TEST.cc
vdb_merger_TEST_LDADD = \
@@ -493,7 +507,8 @@ TESTS = \
e_repository_sets_TEST \
aa_visitor_TEST \
fetch_visitor_TEST \
- source_uri_finder_TEST
+ source_uri_finder_TEST \
+ vdb_repository_TEST
check_PROGRAMS = $(TESTS)
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index 46d02b6..567a757 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -17,14 +17,18 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/repositories/vdb/vdb_repository.hh>
-#include <paludis/util/collection_concrete.hh>
+#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/environments/test/test_environment.hh>
+#include <paludis/package_database.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/query.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <fstream>
#include <iterator>
+#include <libwrapiter/libwrapiter_forward_iterator.hh>
+
using namespace test;
using namespace paludis;
@@ -46,8 +50,7 @@ namespace test_cases
void run()
{
TestEnvironment env;
- tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
+ tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
@@ -68,8 +71,8 @@ namespace test_cases
void run()
{
TestEnvironment env;
- tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
+ tr1::shared_ptr<Map<std::string, std::string> > keys(
+ new Map<std::string, std::string>);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
@@ -94,25 +97,21 @@ namespace test_cases
void run()
{
TestEnvironment env;
- tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
+ tr1::shared_ptr<Map<std::string, std::string> > keys(
+ new Map<std::string, std::string>);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
keys->insert("location", "vdb_repository_TEST_dir/repo1");
- tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(
- &env, keys));
-
- PackageDatabaseEntry e1(CategoryNamePart("cat-one") + PackageNamePart("pkg-one"),
- VersionSpec("1"), RepositoryName("installed"));
- PackageDatabaseEntry e2(CategoryNamePart("cat-one") + PackageNamePart("pkg-neither"),
- VersionSpec("1"), RepositoryName("installed"));
+ tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(&env, keys));
+ env.package_database()->add_repository(1, repo);
- TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag1"), &e1) == use_enabled);
- TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag2"), &e1) == use_enabled);
- TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag3"), &e1) == use_disabled);
+ tr1::shared_ptr<const PackageID> e1(*env.package_database()->query(query::Matches(
+ PackageDepSpec("=cat-one/pkg-one-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
- TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag4"), &e2) == use_unspecified);
+ TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag1"), *e1) == use_enabled);
+ TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag2"), *e1) == use_enabled);
+ TEST_CHECK(repo->use_interface->query_use(UseFlagName("flag3"), *e1) == use_disabled);
}
} test_vdb_repository_query_use;
@@ -126,8 +125,8 @@ namespace test_cases
void run()
{
TestEnvironment env;
- tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
+ tr1::shared_ptr<Map<std::string, std::string> > keys(
+ new Map<std::string, std::string>);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
@@ -152,8 +151,8 @@ namespace test_cases
void run()
{
TestEnvironment env;
- tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
+ tr1::shared_ptr<Map<std::string, std::string> > keys(
+ new Map<std::string, std::string>);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
@@ -178,8 +177,8 @@ namespace test_cases
void run()
{
TestEnvironment env;
- tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
+ tr1::shared_ptr<Map<std::string, std::string> > keys(
+ new Map<std::string, std::string>);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
@@ -204,8 +203,8 @@ namespace test_cases
void run()
{
TestEnvironment env;
- tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
+ tr1::shared_ptr<Map<std::string, std::string> > keys(
+ new Map<std::string, std::string>);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");
@@ -230,8 +229,7 @@ namespace test_cases
void run()
{
TestEnvironment env;
- tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
- new AssociativeCollection<std::string, std::string>::Concrete);
+ tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
keys->insert("format", "vdb");
keys->insert("names_cache", "/var/empty");
keys->insert("provides_cache", "/var/empty");