Add testcase for bnc#433087
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 9 Oct 2008 08:12:58 +0000 (08:12 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 9 Oct 2008 08:12:58 +0000 (08:12 +0000)
tests/zypp/CMakeLists.txt
tests/zypp/Resolvable_test.cc [new file with mode: 0644]

index 742e25c..6c71155 100644 (file)
@@ -26,6 +26,7 @@ ADD_TESTS(
   RepoManager
   RepoStatus
   ResKind
+  Resolvable
   Target
   Url
   Vendor
diff --git a/tests/zypp/Resolvable_test.cc b/tests/zypp/Resolvable_test.cc
new file mode 100644 (file)
index 0000000..a7dae3b
--- /dev/null
@@ -0,0 +1,38 @@
+
+#include <iostream>
+#include <list>
+#include <string>
+
+// Boost.Test
+#include <boost/test/auto_unit_test.hpp>
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/Exception.h"
+#include "zypp/ZYppFactory.h"
+#include "zypp/ZYpp.h"
+#include "zypp/Pattern.h"
+
+#include "TestSetup.h"
+
+using boost::unit_test::test_case;
+using namespace std;
+using namespace zypp;
+
+
+BOOST_AUTO_TEST_CASE(resolvable_test)
+{
+    TestSetup test( Arch_x86_64 );
+    // test.loadTarget(); // initialize and load target
+    test.loadRepo( TESTS_SRC_DIR"/data/openSUSE-11.1" );
+
+    int pattern_count = 0;
+    for_( pitem, test.pool().begin(), test.pool().end() )
+    {
+        if ( isKind<Pattern>(pitem->resolvable()) )
+        {
+            BOOST_CHECK( asKind<Pattern>(pitem->resolvable())->contents().size() > 0 );
+            pattern_count++;
+        }        
+    }
+    BOOST_CHECK(pattern_count > 0);
+}