5 use Test
::Simple tests
=> 5;
7 use Fedora
::Rebuild
::Solver
;
8 use Fedora
::Rebuild
::Set
::Package
;
9 use Fedora
::Rebuild
::Package
;
10 use Fedora
::Rebuild
::RPM
;
14 # Create and return package with one binary package that always provides its
17 my ($name, $provides, $runrequires) = @_;
19 my $package = Fedora
::Rebuild
::Package
->new(
27 $package->provides(shared_clone
(
30 $name => [[Fedora
::Rebuild
::RPM
::ANY
, '']],
35 $package->runrequires(shared_clone
(
43 my $a = build_package
(
46 { 'a' => [[Fedora
::Rebuild
::RPM
::ANY
, '']] },
49 my $b = build_package
(
52 { 'a' => [[Fedora
::Rebuild
::RPM
::ANY
, '']] },
55 my $c = build_package
(
58 { 'd' => [[Fedora
::Rebuild
::RPM
::ANY
, '']] },
61 my $d = build_package
(
64 { 'c' => [[Fedora
::Rebuild
::RPM
::ANY
, '']] },
67 my $e = build_package
(
70 { 'd' => [[Fedora
::Rebuild
::RPM
::ANY
, '']] },
73 # Prepare set of packages
74 my $packages = Fedora
::Rebuild
::Set
::Package
->new();
75 $packages->insert($a);
76 $packages->insert($b);
77 $packages->insert($c);
78 $packages->insert($d);
79 $packages->insert($e);
82 my $solver = Fedora
::Rebuild
::Solver
->new(packages
=> $packages,
83 dependencyfilter
=> sub {0});
89 ok
($solver->is_installable($a, 'a', \
$message),
90 "a requires itself: $message");
91 ok
($solver->is_installable($b, 'b', \
$message),
92 "b requires reflexive a: $message");
95 ok
($solver->is_installable($d, 'd', \
$message),
96 "d requires c that requires d: $message");
97 ok
($solver->is_installable($c, 'c', \
$message),
98 "c requires d that requires c: $message");
99 ok
($solver->is_installable($e, 'e', \
$message),
100 "e requiers d that requires c that requires d: $message");