2 #include "zypp/PoolQuery.h"
3 #include "zypp/PoolQueryUtil.tcc"
5 #define BOOST_TEST_MODULE PoolQuery
7 /////////////////////////////////////////////////////////////////////////////
8 static TestSetup test( Arch_x86_64 );
10 BOOST_AUTO_TEST_CASE(pool_query_init)
12 // Abuse;) vbox as System repo:
13 test.loadTargetRepo( TESTS_SRC_DIR "/data/obs_virtualbox_11_1" );
14 test.loadRepo( TESTS_SRC_DIR "/data/openSUSE-11.1", "opensuse" );
15 test.loadRepo( TESTS_SRC_DIR "/data/OBS_zypp_svn-11.1", "zyppsvn" );
17 dumpRange( USR, test.pool().knownRepositoriesBegin(),
18 test.pool().knownRepositoriesEnd() );
19 USR << "pool: " << test.pool() << endl;
21 /////////////////////////////////////////////////////////////////////////////
23 static std::ofstream devNull;
28 PrintAndCount() : _count(0) {}
30 bool operator()( const sat::Solvable & solvable )
32 zypp::PoolItem pi( zypp::ResPool::instance().find( solvable ) );
33 COUT << pi.resolvable() << endl;
41 void dumpQ( std::ostream & str, const PoolQuery & q, bool verbose = true )
48 for_( it, q.begin(), q.end() )
54 str << "--> MATCHES: " << nc << endl;
60 BOOST_AUTO_TEST_CASE(pool_query_experiment)
62 cout << "****experiment****" << endl;
65 q.addString("zypper");
66 q.addAttribute(sat::SolvAttr::name);
68 // should list 1 selectable?
69 cout << "****selectables****" << endl;
70 for (PoolQuery::Selectable_iterator it = q.selectableBegin();
71 it != q.selectableEnd(); ++it)
73 ui::Selectable::Ptr s = *it;
74 cout << s->kind() << ":" << s->name() << " hasinstalled: " << s->installedEmpty() << endl;
76 cout << "****solvables****" << endl;
78 std::for_each(q.begin(), q.end(), cb);
82 /////////////////////////////////////////////////////////////////////////////
84 /////////////////////////////////////////////////////////////////////////////
86 // no conditions, default query
87 // result: all available resolvables
88 BOOST_AUTO_TEST_CASE(pool_query_000)
90 cout << "****000****" << endl;
92 cout << q.size() << endl;
93 BOOST_CHECK(q.size() == 3811);
95 /* dumpsolv repo1.solv repo2.solv repo3.solv | \
96 grep '^name:.*\(noarch\|x86_64\|i386\|i586\|i686\|src\)$' | wc -l */
99 // default query + one search string
100 // q.addString("foo");
101 // result: all resolvables having at least one attribute matching foo
102 BOOST_AUTO_TEST_CASE(pool_query_001)
104 cout << "****001****" << endl;
106 q.addString("zypper");
108 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 11);
111 // default query + one attribute + one string
112 // q.addAttribute(foo, bar);
113 // should be the same as
114 // q.addAttribute(foo); q.addString(bar);
115 // result: resolvables with foo containing bar
116 BOOST_AUTO_TEST_CASE(pool_query_002)
118 cout << "****002****" << endl;
120 q.addString("zypper");
121 q.addAttribute(sat::SolvAttr::name);
123 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 5);
128 q1.addAttribute(sat::SolvAttr::name, "zypper");
130 BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 5);
134 BOOST_AUTO_TEST_CASE(pool_query_003)
136 cout << "****003****" << endl;
138 q.addString("zypper");
139 q.addAttribute(sat::SolvAttr::name);
140 q.addKind(ResKind::package);
142 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 3);
146 BOOST_AUTO_TEST_CASE(pool_query_004)
148 cout << "****004****" << endl;
151 q.addAttribute(sat::SolvAttr::name);
154 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1);
157 q1.addString("zypp");
158 q1.addAttribute(sat::SolvAttr::name);
161 std::for_each(q1.begin(), q1.end(), PrintAndCount());
162 BOOST_CHECK(q1.empty());
166 BOOST_AUTO_TEST_CASE(pool_query_005)
168 cout << "****005.1****" << endl;
171 q.addAttribute(sat::SolvAttr::name);
174 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6);
176 cout << "****005.2****" << endl;
179 q1.addString("*zypp*");
180 q1.addAttribute(sat::SolvAttr::name);
183 BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 26);
185 cout << "****005.3****" << endl;
187 // should be the same as above
189 q2.addString("zypp");
190 q2.addAttribute(sat::SolvAttr::name);
192 BOOST_CHECK(q2.size() == 26);
196 BOOST_AUTO_TEST_CASE(pool_query_006)
198 cout << "****006.1***" << endl;
200 // should be the same as 005 1
202 q.addString("^z.p.*");
203 q.addAttribute(sat::SolvAttr::name);
206 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6);
208 cout << "****006.2***" << endl;
211 q1.addString("zypper|smart");
212 q1.addAttribute(sat::SolvAttr::name);
215 BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 8);
217 cout << "****006.3***" << endl;
221 q2.addString("zypp\\");
223 BOOST_CHECK_THROW(q2.begin(), Exception);
228 BOOST_AUTO_TEST_CASE(pool_query_007)
230 cout << "****007***" << endl;
234 q.addAttribute(sat::SolvAttr::name);
237 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6);
240 // match by installed status (basically by system vs. repo)
241 BOOST_AUTO_TEST_CASE(pool_query_050)
243 cout << "****050****" << endl;
246 q.addAttribute(sat::SolvAttr::name);
248 q.setInstalledOnly();
250 BOOST_CHECK_EQUAL(std::for_each(q.begin(), q.end(), PrintAndCount())._count, 4);
255 q1.addString("zypper");
256 q1.addAttribute(sat::SolvAttr::name);
258 q1.setUninstalledOnly();
259 BOOST_CHECK_EQUAL(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count, 5);
262 /////////////////////////////////////////////////////////////////////////////
263 // 1xx multiple attribute queries
264 /////////////////////////////////////////////////////////////////////////////
267 BOOST_AUTO_TEST_CASE(pool_query_100)
269 cout << "****100****" << endl;
271 /* This string is found sometimes only in only in summary (e.g. pgcalc)
272 and sometimes only in description (e.g. bc, lftp). We don't have
273 any package with 'revers' only in package name, but let's ignore this.
274 I didn't find a string with the same characteristics giving fewer matches
276 q.addString("revers");
277 q.addAttribute(sat::SolvAttr::name);
278 q.addAttribute(sat::SolvAttr::summary);
279 q.addAttribute(sat::SolvAttr::description);
281 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 5);
287 q1.addAttribute(sat::SolvAttr::name, "zypper");
288 BOOST_CHECK_EQUAL(q1.size(),5);
291 q2.addAttribute(sat::SolvAttr::summary,"samba");
292 BOOST_CHECK_EQUAL(q2.size(),13);
294 // now summary and name in one go:
295 q1.addAttribute(sat::SolvAttr::summary,"samba");
296 BOOST_CHECK_EQUAL(q1.size(),18);
301 // multi attr (same value) substring matching (case sensitive and insensitive)
302 BOOST_AUTO_TEST_CASE(pool_query_101)
304 cout << "****101****" << endl;
307 q.addString("RELAX");
308 q.addAttribute(sat::SolvAttr::name);
309 q.addAttribute(sat::SolvAttr::summary);
310 q.addAttribute(sat::SolvAttr::description);
312 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 7);
317 q2.addString("RELAX");
318 q2.addAttribute(sat::SolvAttr::name);
319 q2.addAttribute(sat::SolvAttr::summary);
320 q2.addAttribute(sat::SolvAttr::description);
321 q2.setCaseSensitive();
323 BOOST_CHECK(std::for_each(q2.begin(), q2.end(), PrintAndCount())._count == 4);
327 // multi attr (same value) glob matching (case sensitive and insensitive)
328 BOOST_AUTO_TEST_CASE(pool_query_102)
330 cout << "****102****" << endl;
332 q.addString("pack*");
333 q.addAttribute(sat::SolvAttr::name);
334 q.addAttribute(sat::SolvAttr::summary);
337 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 23);
341 // multi attr (same value via addAttribute())
342 BOOST_AUTO_TEST_CASE(pool_query_103)
344 cout << "****103.1****" << endl;
346 q.addAttribute(sat::SolvAttr::name, "rest");
347 q.addAttribute(sat::SolvAttr::summary, "rest");
349 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 14);
351 cout << "****103.2****" << endl;
354 q1.addString("rest");
355 q1.addAttribute(sat::SolvAttr::name);
356 q1.addAttribute(sat::SolvAttr::summary);
358 BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 14);
359 // BOOST_CHECK(q1.size() == 42);
364 // multiple attributes, different search strings (one string per attrbute)
365 BOOST_AUTO_TEST_CASE(pool_query_104)
367 cout << "****104****" << endl;
369 q.addAttribute(sat::SolvAttr::name, "zypper");
370 q.addAttribute(sat::SolvAttr::summary, "package management");
372 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 8);
375 // multiple attributes, different search strings (one string per attrbute), regex matching
376 BOOST_AUTO_TEST_CASE(pool_query_105)
378 cout << "****105****" << endl;
380 q.addAttribute(sat::SolvAttr::name, "zy..er");
381 q.addAttribute(sat::SolvAttr::summary, "package management");
384 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 8);
387 /////////////////////////////////////////////////////////////////////////////
388 // 3xx repo filter queries (addRepo(alias_str))
389 /////////////////////////////////////////////////////////////////////////////
391 // default query + one attribute(one string) + one repo
392 BOOST_AUTO_TEST_CASE(pool_query_300)
394 cout << "****300****" << endl;
396 q.addAttribute(sat::SolvAttr::name, "zypper");
397 q.addRepo("zyppsvn");
399 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 4);
402 // default query + one repo
403 BOOST_AUTO_TEST_CASE(pool_query_301)
405 cout << "****301****" << endl;
407 q.addRepo("zyppsvn");
409 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 42);
412 // multiple repos + one attribute
413 BOOST_AUTO_TEST_CASE(pool_query_302)
415 cout << "****302****" << endl;
417 q.addString("zypper");
418 q.addAttribute(sat::SolvAttr::name);
419 q.addRepo("opensuse");
420 q.addRepo("zyppsvn");
422 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 5);
425 /////////////////////////////////////////////////////////////////////////////
426 // 4xx kind queries (addKind(ResKind))
427 /////////////////////////////////////////////////////////////////////////////
429 BOOST_AUTO_TEST_CASE(pool_query_400)
431 cout << "****400****" << endl;
433 q.addString("lamp_server");
434 q.addAttribute(sat::SolvAttr::name);
435 q.addKind(ResKind::pattern);
438 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1);
441 // should find packages and patterns
442 BOOST_AUTO_TEST_CASE(pool_query_401)
444 cout << "****401****" << endl;
446 q.addString("mail*");
447 q.addAttribute(sat::SolvAttr::name);
450 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 4);
454 /////////////////////////////////////////////////////////////////////////////
455 // 5xx multiple string/attribute queries
456 /////////////////////////////////////////////////////////////////////////////
458 // multiple strings for one attribute
459 BOOST_AUTO_TEST_CASE(pool_query_500)
461 cout << "****500.1****" << endl;
463 q.addString("zypper");
464 q.addString("yast2-packager");
465 q.addAttribute(sat::SolvAttr::name);
467 // creates: ^(apt|zypper)$
468 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 6);
470 cout << "****500.2****" << endl;
471 q.addString("*bzypp");
473 // creates: ^(.*zy.p|yast.*package.*|.*bzypp)$
474 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 11);
476 cout << "****500.3****" << endl;
478 q1.addString("^libsm[a-z]*[0-9]$");
479 q1.addAttribute(sat::SolvAttr::name, "bzypp$");
480 q1.addKind(ResKind::package);
482 // creates: (^libsm[a-z]*[0-9]$|bzypp$)
483 BOOST_CHECK(std::for_each(q1.begin(), q1.end(), PrintAndCount())._count == 5);
485 cout << "****500.4****" << endl;
487 q2.addString("Thunder");
488 q2.addAttribute(sat::SolvAttr::name, "sun");
489 q2.addKind(ResKind::package);
490 q2.addRepo("opensuse");
491 q2.setCaseSensitive();
492 // creates: (sun|Thunder)
493 BOOST_CHECK(std::for_each(q2.begin(), q2.end(), PrintAndCount())._count == 3);
495 cout << "****500.5****" << endl;
497 q3.addString("audio");
498 q3.addAttribute(sat::SolvAttr::name, "zip");
499 q3.addKind(ResKind::package);
500 q3.addRepo("opensuse");
502 // creates: \b(zip|audio)\b
503 BOOST_CHECK(std::for_each(q3.begin(), q3.end(), PrintAndCount())._count == 3);
506 // multiple strings, multiple attributes, same strings
507 BOOST_AUTO_TEST_CASE(pool_query_501)
509 cout << "****501****" << endl;
511 q.addString("Thunder");
512 q.addString("storm");
513 q.addAttribute(sat::SolvAttr::name);
514 q.addAttribute(sat::SolvAttr::description);
515 q.addKind(ResKind::package);
516 q.addRepo("opensuse");
518 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 14);
521 // multiple strings, multiple attributes, same strings
522 BOOST_AUTO_TEST_CASE(pool_query_502)
524 cout << "****502****" << endl;
526 q.addString("weather");
527 q.addAttribute(sat::SolvAttr::name, "thunder");
528 q.addAttribute(sat::SolvAttr::description, "storm");
529 q.addKind(ResKind::package);
530 q.addRepo("opensuse");
532 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 13);
535 /////////////////////////////////////////////////////////////////////////////
536 // 6xx queries with edition
537 /////////////////////////////////////////////////////////////////////////////
539 BOOST_AUTO_TEST_CASE(pool_query_X)
541 cout << "****600.1****" << endl;
543 q.addAttribute(sat::SolvAttr::name, "zypper");
545 q.setEdition(Edition("0.12.5"), Rel::GT);
547 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 4);
549 cout << "****600.2****" << endl;
550 q.setEdition(Edition("0.12.5"), Rel::LT);
552 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 0);
554 cout << "****600.3****" << endl;
555 q.setEdition(Edition("0.12.5"), Rel::LE);
557 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1);
559 cout << "****600.4****" << endl;
560 q.setEdition(Edition("0.12.5-5"), Rel::LT);
562 BOOST_CHECK(std::for_each(q.begin(), q.end(), PrintAndCount())._count == 1);
565 BOOST_AUTO_TEST_CASE(pool_query_X1)
567 cout << "****601.****" << endl;
569 q.addString("zypper");
570 q.addAttribute(sat::SolvAttr::name );
571 BOOST_CHECK_EQUAL(std::for_each(q.begin(), q.end(), PrintAndCount())._count, 5);
573 q.setEdition(Edition("0.12.8"), Rel::GE);
574 BOOST_CHECK_EQUAL(std::for_each(q.begin(), q.end(), PrintAndCount())._count, 4);
577 BOOST_AUTO_TEST_CASE(pool_query_X2)
579 cout << "****X****" << endl;
582 q.addString("zypp*");
583 q.addAttribute(sat::SolvAttr::name);
585 BOOST_CHECK_EQUAL(std::for_each(q.begin(), q.end(), PrintAndCount())._count, 5);
589 BOOST_AUTO_TEST_CASE(pool_query_recovery)
591 Pathname testfile(TESTS_SRC_DIR);
592 testfile += "/zypp/data/PoolQuery/savedqueries";
593 cout << "****recovery****" << endl;
595 std::vector<PoolQuery> queries;
596 std::insert_iterator<std::vector<PoolQuery> > ii( queries,queries.begin());
597 readPoolQueriesFromFile(testfile,ii);
598 BOOST_REQUIRE_MESSAGE(queries.size() == 2, "Bad count of read queries.");
600 BOOST_CHECK_EQUAL(queries[0].size(), 8);
604 q.addRepo("opensuse");
605 q.addKind(ResKind::patch);
608 q.setCaseSensitive();
609 q.setUninstalledOnly();
610 q.setEdition(Edition("0.8.3"),Rel::NE);
611 BOOST_CHECK(q == queries[1]);
614 BOOST_AUTO_TEST_CASE(pool_predicated_matcher)
616 cout << "****predicated_matcher****" << endl;
621 q.addDependency( sat::SolvAttr::name, "zy*", Rel::ANY, Edition(), Arch_empty );
622 BOOST_CHECK_EQUAL( q.size(), 0 );
624 q.addDependency( sat::SolvAttr::name, "zy*", Rel::ANY, Edition(), Arch_empty, Match::GLOB );
625 BOOST_CHECK_EQUAL( q.size(), 5 ); // 5 more
627 q.addDependency( sat::SolvAttr::name, "^kde.*-zh", Rel::ANY, Edition(), Arch_noarch, Match::REGEX );
628 BOOST_CHECK_EQUAL( q.size(), 9 ); // 4 more
630 q.addDependency( sat::SolvAttr::name, "kde.*-zh", Rel::ANY, Edition(), Arch_noarch, Match::REGEX );
631 BOOST_CHECK_EQUAL( q.size(), 10 ); // 1 more
635 BOOST_AUTO_TEST_CASE(pool_query_serialize)
637 std::vector<PoolQuery> queries;
641 q.addAttribute( sat::SolvAttr::name );
642 q.addRepo( "factory-nonoss" );
643 q.addRepo( "zypp_svn" );
644 queries.push_back( q );
648 q.addAttribute( sat::SolvAttr::name, "ma" );
649 q.addRepo( "factory-nonoss" );
650 q.addRepo( "zypp_svn" );
651 queries.push_back( q );
656 q.addAttribute( sat::SolvAttr::name, "ma" );
657 q.addDependency( sat::SolvAttr::name, "nn", Rel::EQ, Edition("nne-nnr"), Arch_noarch );
658 q.addDependency( sat::SolvAttr::name, "nx", Rel::EQ, Edition("nxe-nxr"), Arch_noarch, Match::REGEX );
659 q.addDependency( sat::SolvAttr::requires, "rn", Rel::EQ, Edition("rne-rnr"), Arch_noarch );
660 q.addDependency( sat::SolvAttr::requires, "rx", Rel::EQ, Edition("rxe-rxr"), Arch_noarch, Match::GLOB );
661 queries.push_back( q );
664 cout << "****serialize****" << endl;
665 // filesystem::TmpFile testfile;
666 Pathname testfile( "/tmp/testfile" );
667 writePoolQueriesToFile( testfile, queries.begin(), queries.end() );
669 std::vector<PoolQuery> recovered;
670 std::insert_iterator<std::vector<PoolQuery>> ii( recovered, recovered.end() );
671 readPoolQueriesFromFile( testfile, ii );
673 BOOST_REQUIRE_EQUAL( queries.size(), recovered.size() );
674 for ( unsigned i = 0U; i < queries.size(); ++i )
676 BOOST_CHECK_EQUAL( queries[i], recovered[i] );
680 BOOST_AUTO_TEST_CASE(pool_query_equal)
682 cout << "****equal****" << endl;
683 std::vector<PoolQuery> v;
690 q.addAttribute( sat::SolvAttr::name, "zypper" );
692 q.setCaseSensitive(true);
697 q.addAttribute( sat::SolvAttr::name, "libzypp" ); // different
699 q.setCaseSensitive(true);
704 q.addAttribute( sat::SolvAttr::vendor, "zypper" ); // different
706 q.setCaseSensitive(true);
711 q.addAttribute( sat::SolvAttr::name, "zypper" );
713 q.setCaseSensitive(false); // different
718 q.addAttribute( sat::SolvAttr::name, "zypper" );
719 q.setMatchSubstring(); // different
720 q.setCaseSensitive(true);
725 q.addDependency( sat::SolvAttr::provides, "zypper" );
730 q.addDependency( sat::SolvAttr::provides, "zypper", Rel::GT, Edition("1.0") );
735 q.addDependency( sat::SolvAttr::provides, "zypper", Rel::GT, Edition("2.0") );
739 for (size_t li = 0; li < v.size(); ++li)
741 for (size_t ri = 0; ri < v.size(); ++ri)
743 COUT << li << " <> " << ri << endl;
744 bool equal( v[li] == v[ri] );
745 bool nequal( v[li] != v[ri] );
746 BOOST_CHECK_EQUAL( equal, li==ri );
747 BOOST_CHECK_EQUAL( equal, !nequal );
752 /////////////////////////////////////////////////////////////////////////////
754 /////////////////////////////////////////////////////////////////////////////
756 BOOST_AUTO_TEST_CASE(addDependency)
759 cout << "****addDependency1****" << endl;
761 q.setCaseSensitive( false );
762 q.setMatchSubstring();
763 q.addString( "libzypp" );
764 q.addDependency( sat::SolvAttr::provides, "FOO" ); // ! finds 'perl(CPAN::InfoObj)' 'foO'
765 std::for_each(q.begin(), q.end(), PrintAndCount());
766 //dumpQ( std::cout, q );
767 BOOST_CHECK_EQUAL( q.size(), 13 );
770 cout << "****addDependency2****" << endl;
772 q.setCaseSensitive( false );
773 q.setMatchSubstring();
774 q.addString( "libzypp" );
775 q.addDependency( sat::SolvAttr::provides, "FOO", Rel::GT, Edition("5.0") );
776 std::for_each(q.begin(), q.end(), PrintAndCount());
777 //dumpQ( std::cout, q );
778 BOOST_CHECK_EQUAL( q.size(), 7 );
781 cout << "****addDependency2a****" << endl;
783 q.setCaseSensitive( false );
784 q.setMatchSubstring();
785 q.addDependency( sat::SolvAttr::provides, "libzypp", Rel::GT, Edition("5.0") );
786 q.addAttribute( sat::SolvAttr::arch, Arch_i586.asString() ); // OR with arch i585
787 std::for_each(q.begin(), q.end(), PrintAndCount());
788 //dumpQ( std::cout, q );
789 BOOST_CHECK_EQUAL( q.size(), 66 );
792 cout << "****addDependency2b****" << endl;
794 q.setCaseSensitive( false );
795 q.setMatchSubstring();
796 // libzypp provides yast2-packagemanager...
797 q.addDependency( sat::SolvAttr::provides, "yast2-packagemanager", Rel::GT, Edition("5.0"), Arch_i586 ); // AND with arch i585
798 std::for_each(q.begin(), q.end(), PrintAndCount());
799 //dumpQ( std::cout, q );
800 BOOST_CHECK_EQUAL( q.size(), 2 );
803 cout << "****addDependency2c****" << endl;
805 q.setCaseSensitive( false );
806 q.setMatchSubstring();
807 // but no package named yast2-packagemanager
808 q.addDependency( sat::SolvAttr::name, "yast2-packagemanager", Rel::GT, Edition("5.0"), Arch_i586 ); // AND with arch i585
809 std::for_each(q.begin(), q.end(), PrintAndCount());
810 //dumpQ( std::cout, q );
811 BOOST_CHECK_EQUAL( q.size(), 0 );
814 cout << "****addDependency2d****" << endl;
816 q.setCaseSensitive( false );
817 q.setMatchSubstring();
818 // libzypp provides yast2-packagemanager...
819 q.addDependency( sat::SolvAttr::provides, "yast2-packagemanager", Arch_i586 ); // AND with arch i585
820 std::for_each(q.begin(), q.end(), PrintAndCount());
821 //dumpQ( std::cout, q );
822 BOOST_CHECK_EQUAL( q.size(), 2 );
825 cout << "****addDependency2e****" << endl;
827 q.setCaseSensitive( false );
828 q.setMatchSubstring();
829 // but no package named yast2-packagemanager
830 q.addDependency( sat::SolvAttr::name, "yast2-packagemanager", Arch_i586 ); // AND with arch i585
831 std::for_each(q.begin(), q.end(), PrintAndCount());
832 //dumpQ( std::cout, q );
833 BOOST_CHECK_EQUAL( q.size(), 0 );
837 cout << "****addDependency3****" << endl;
840 q.addDependency( sat::SolvAttr::provides, "kernel" );
841 std::for_each(q.begin(), q.end(), PrintAndCount());
842 //dumpQ( std::cout, q );
843 BOOST_CHECK_EQUAL( q.size(), 12 );
846 cout << "****addDependency4****" << endl;
849 q.addDependency( sat::SolvAttr::name, "kernel" );
850 std::for_each(q.begin(), q.end(), PrintAndCount());
851 //dumpQ( std::cout, q );
852 BOOST_CHECK_EQUAL( q.size(), 11 );
855 cout << "****addDependency5****" << endl;
857 // Capability always matches exact
858 q.addDependency( sat::SolvAttr::provides, Capability("kernel") );
859 std::for_each(q.begin(), q.end(), PrintAndCount());
860 //dumpQ( std::cout, q );
861 BOOST_CHECK_EQUAL( q.size(), 2 );
864 cout << "****addDependency6****" << endl;
866 // non dependecy + Capability matches solvable name!
867 q.addDependency( sat::SolvAttr::summary, Capability("kernel") );
868 std::for_each(q.begin(), q.end(), PrintAndCount());
869 //dumpQ( std::cout, q );
870 BOOST_CHECK_EQUAL( q.size(), 0 ); // non dependecy