Author: jreidinger
Date: Tue May 20 16:57:13 2008
New Revision: 10168
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10168&view=rev
Log:
Oooops, forget add test file :)
Added:
trunk/libzypp/tests/zypp/Deltarpm_test.cc
Added: trunk/libzypp/tests/zypp/Deltarpm_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/Deltarpm_test.cc?rev=10168&view=auto
==============================================================================
--- trunk/libzypp/tests/zypp/Deltarpm_test.cc (added)
+++ trunk/libzypp/tests/zypp/Deltarpm_test.cc Tue May 20 16:57:13 2008
@@ -0,0 +1,66 @@
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <list>
+#include <string>
+
+#include
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/Exception.h"
+#include "zypp/PathInfo.h"
+#include "zypp/RepoManager.h"
+#include "zypp/sat/Pool.h"
+#include "zypp/repo/DeltaCandidates.h"
+#include "zypp/repo/PackageDelta.h"
+#include "KeyRingTestReceiver.h"
+
+using boost::unit_test::test_case;
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::repo;
+using namespace zypp::filesystem;
+
+#define TEST_DIR TESTS_SRC_DIR "/zypp/data/Delta"
+
+BOOST_AUTO_TEST_CASE(delta)
+{
+ KeyRingTestReceiver rec;
+ rec.answerAcceptUnknownKey(true);
+// rec.answerImportKey(true);
+ Pathname rootdir(TEST_DIR );
+ RepoManagerOptions opts(rootdir);
+ opts.repoRawCachePath = rootdir;
+ opts.repoSolvCachePath = rootdir;
+ RepoManager rm(opts);
+
+ RepoInfo updates;
+ updates.setAlias("updates");
+ updates.addBaseUrl(Url(string("dir:") + rootdir.absolutename().asString() ));
+
+ try
+ {
+ rm.buildCache(updates);
+ rm.loadFromCache(updates);
+ }
+ catch (const Exception & e)
+ {
+ BOOST_FAIL( string("Problem getting the data: ")+ e.msg()) ;
+ }
+ sat::Pool pool(sat::Pool::instance());
+
+ repo::DeltaCandidates dc(list<Repository>(pool.reposBegin(),pool.reposEnd()), "libzypp");
+
+ std::listpackagedelta::DeltaRpm deltas = dc.deltaRpms(0);
+ for_ (it,deltas.begin(),deltas.end())
+ {
+ BOOST_CHECK(it->name()=="libzypp");
+// BOOST_CHECK((it->edition()==Edition("0:4.21.3-2")));
+// BOOST_CHECK(it->arch()=="i386");
+ BOOST_CHECK((it->baseversion().edition() == Edition("4.21.3-1"))
+ ||(it->baseversion().edition() == Edition("4.21.2-3")));
+ cout << it->name() << " - " << it->edition() << " - " << it->arch() << " base: " << it->baseversion().edition() << endl;
+ }
+ rm.cleanCache(updates);
+}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org