a999d25102956e8dd533bd8b73e049b5e81e76e0
[platform/upstream/libzypp.git] / tests / zypp / PoolQuery_test.cc
1 #include <stdio.h>
2 #include <iostream>
3 #include <boost/test/unit_test.hpp>
4
5 #include "zypp/ZYppFactory.h"
6 #include "zypp/PoolQuery.h"
7
8 #define BOOST_TEST_MODULE PoolQuery
9
10 using std::cout;
11 using std::endl;
12 using std::string;
13 using namespace zypp;
14 using namespace boost::unit_test;
15
16 bool result_cb( const ResObject::Ptr &r )
17 {
18   cout << r << endl;
19   return true;
20 }
21
22 BOOST_AUTO_TEST_CASE(pool_query )
23 {
24   Pathname dir(TESTS_SRC_DIR);
25   dir += "/zypp/data/PoolQuery";
26
27   ZYpp::Ptr z = getZYpp();
28     
29   sat::Pool::instance().addRepoSolv(dir + "foo.solv");
30
31   PoolQuery query;
32   //query.setInstalledOnly();
33   query.execute("kde", &result_cb);
34
35   cout << "search done." << endl;
36
37   query.setMatchExact(true);
38   query.execute("kde", &result_cb);
39   
40   cout << "search done." << endl;
41 }
42
43 // bool init_function() {
44 //   framework::master_test_suite().add( BOOST_TEST_CASE( boost::bind( &poolquery_simple_test) ) );
45 //   return true;
46 // } 
47 // 
48 // int
49 // main( int argc, char* argv[] )
50 // {
51 // return ::boost::unit_test::unit_test_main( &init_function, argc, argv );
52 // } 
53
54 // vim: set ts=2 sts=2 sw=2 ai et: