ref: refs/heads/master
commit 06d13b6294c87073101e830e77fbb0b63250c8d6
Author: Michael Andres
Date: Tue Sep 29 13:31:39 2009 +0200
Add Selectable testcase
---
tests/data/TCSelectable/RepoHIGH.xml | 20 ++++++++++++++
tests/data/TCSelectable/RepoLOW.xml | 20 ++++++++++++++
tests/data/TCSelectable/RepoMID.xml | 20 ++++++++++++++
tests/data/TCSelectable/solver-system.xml | 11 ++++++++
tests/data/TCSelectable/solver-test.xml | 23 ++++++++++++++++
tests/zypp/CMakeLists.txt | 1 +
tests/zypp/Selectable_test.cc | 40 +++++++++++++++++++++++++++++
7 files changed, 135 insertions(+), 0 deletions(-)
diff --git a/tests/data/TCSelectable/RepoHIGH.xml b/tests/data/TCSelectable/RepoHIGH.xml
new file mode 100644
index 0000000..6cfccd6
--- /dev/null
+++ b/tests/data/TCSelectable/RepoHIGH.xml
@@ -0,0 +1,20 @@
+<channel><subchannel>
+<package>
+ <name>candidate</name>
+ <vendor>unkown</vendor>
+ <history><update>
+ <arch>x86_64</arch>
+ <version>4</version>
+ <release>1</release>
+ </update></history>
+</package>
+<package>
+ <name>candidate</name>
+ <vendor>unkown</vendor>
+ <history><update>
+ <arch>i586</arch>
+ <version>4</version>
+ <release>1</release>
+ </update></history>
+</package>
+</subchannel></channel>
diff --git a/tests/data/TCSelectable/RepoLOW.xml b/tests/data/TCSelectable/RepoLOW.xml
new file mode 100644
index 0000000..71f335a
--- /dev/null
+++ b/tests/data/TCSelectable/RepoLOW.xml
@@ -0,0 +1,20 @@
+<channel><subchannel>
+<package>
+ <name>candidate</name>
+ <vendor>openSUSE</vendor>
+ <history><update>
+ <arch>x86_64</arch>
+ <version>2</version>
+ <release>1</release>
+ </update></history>
+</package>
+<package>
+ <name>candidate</name>
+ <vendor>openSUSE</vendor>
+ <history><update>
+ <arch>i586</arch>
+ <version>2</version>
+ <release>1</release>
+ </update></history>
+</package>
+</subchannel></channel>
diff --git a/tests/data/TCSelectable/RepoMID.xml b/tests/data/TCSelectable/RepoMID.xml
new file mode 100644
index 0000000..f1b6d1d
--- /dev/null
+++ b/tests/data/TCSelectable/RepoMID.xml
@@ -0,0 +1,20 @@
+<channel><subchannel>
+<package>
+ <name>candidate</name>
+ <vendor>SUSE</vendor>
+ <history><update>
+ <arch>x86_64</arch>
+ <version>0</version>
+ <release>1</release>
+ </update></history>
+</package>
+<package>
+ <name>candidate</name>
+ <vendor>SUSE</vendor>
+ <history><update>
+ <arch>i586</arch>
+ <version>0</version>
+ <release>1</release>
+ </update></history>
+</package>
+</subchannel></channel>
diff --git a/tests/data/TCSelectable/solver-system.xml b/tests/data/TCSelectable/solver-system.xml
new file mode 100644
index 0000000..4fe7341
--- /dev/null
+++ b/tests/data/TCSelectable/solver-system.xml
@@ -0,0 +1,11 @@
+<channel><subchannel>
+<package>
+ <name>candidate</name>
+ <vendor>openSUSE</vendor>
+ <history><update>
+ <arch>i586</arch>
+ <version>1</version>
+ <release>1</release>
+ </update></history>
+</package>
+</subchannel></channel>
diff --git a/tests/data/TCSelectable/solver-test.xml b/tests/data/TCSelectable/solver-test.xml
new file mode 100644
index 0000000..64a28d4
--- /dev/null
+++ b/tests/data/TCSelectable/solver-test.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<test>
+<setup arch="x86_64">
+ <system file="solver-system.xml"/>
+ <!--
+ - alias : RepoHIGH
+ - url : http://foo.org/distribution/HIGH
+ -->
+ <channel file="RepoHIGH.xml" name="RepoHIGH" priority="10" />
+ <!--
+ - alias : RepoMID
+ - url : http://foo.org/distribution/MID
+ -->
+ <channel file="RepoMID.xml" name="RepoMID" priority="50" />
+ <!--
+ - alias : RepoLOW
+ - url : http://foo.org/distribution/LOW
+ -->
+ <channel file="RepoLOW.xml" name="RepoLOW" priority="99" />
+ <locale name="en_US" />
+ <locale name="de" />
+</setup>
+</test>
diff --git a/tests/zypp/CMakeLists.txt b/tests/zypp/CMakeLists.txt
index ed43863..a4a2495 100644
--- a/tests/zypp/CMakeLists.txt
+++ b/tests/zypp/CMakeLists.txt
@@ -29,6 +29,7 @@ ADD_TESTS(
RepoStatus
ResKind
ResStatus
+ Selectable
Target
Url
Vendor
diff --git a/tests/zypp/Selectable_test.cc b/tests/zypp/Selectable_test.cc
new file mode 100644
index 0000000..5c80d5f
--- /dev/null
+++ b/tests/zypp/Selectable_test.cc
@@ -0,0 +1,40 @@
+#include "TestSetup.h"
+#include "zypp/ResPool.h"
+#include "zypp/ui/Selectable.h"
+
+#define BOOST_TEST_MODULE Selectable
+
+/////////////////////////////////////////////////////////////////////////////
+
+static TestSetup test;
+
+BOOST_AUTO_TEST_CASE(testcase_init)
+{
+ zypp::base::LogControl::instance().logToStdErr();
+ test.loadTestcaseRepos( TESTS_SRC_DIR"/data/TCSelectable" );
+
+/* dumpRange( USR, test.pool().knownRepositoriesBegin(),
+ test.pool().knownRepositoriesEnd() ) << endl;
+ USR << "pool: " << test.pool() << endl;*/
+}
+/////////////////////////////////////////////////////////////////////////////
+
+BOOST_AUTO_TEST_CASE(candiadate)
+{
+ ResPoolProxy poolProxy( test.poolProxy() );
+ ui::Selectable::Ptr s( poolProxy.lookup( ResKind::package, "candidate" ) );
+ // (I 1) {
+ // I__s_(8)candidate-1-1.i586(@System)(openSUSE)
+ // } (A 6) {
+ // U__s_(2)candidate-4-1.x86_64(RepoHIGH)(unkown)
+ // U__s_(3)candidate-4-1.i586(RepoHIGH)(unkown)
+ // U__s_(6)candidate-0-1.x86_64(RepoMID)(SUSE)
+ // U__s_(7)candidate-0-1.i586(RepoMID)(SUSE) <- candidate (highrst prio matching arch and vendor)
+ // U__s_(4)candidate-2-1.x86_64(RepoLOW)(openSUSE)
+ // U__s_(5)candidate-2-1.i586(RepoLOW)(openSUSE)
+ // }
+ BOOST_CHECK_EQUAL( s->candidateObj()->repoInfo().alias(), "RepoMID" );
+ BOOST_CHECK_EQUAL( s->candidateObj()->edition(), Edition("0-1") );
+ // no updateCandidate due to low version
+ BOOST_CHECK_EQUAL( s->updateCandidateObj(), PoolItem() );
+}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org