5 use Test
::More tests
=> 1 + 2 * 2 + 5;
7 use Fedora
::Rebuild
::Package
;
8 use Fedora
::Rebuild
::RPM
;
9 use Fedora
::Rebuild
::Providers
;
13 my ($name, $provides) = @_;
15 my $package = Fedora
::Rebuild
::Package
->new(
23 $package->provides(shared_clone
($provides));
29 my $providers = Fedora
::Rebuild
::Providers
->new();
30 ok
(defined $providers, 'create Fedora::Rebuild::Providers object');
32 my $a = build_package
(
37 [Fedora
::Rebuild
::RPM
::ANY
, '']
40 [Fedora
::Rebuild
::RPM
::EQUAL
, '1']
45 [Fedora
::Rebuild
::RPM
::ANY
, '']
50 ok
(defined $a, 'create package a');
51 $providers->insert($a);
53 $providers->providers(),
56 [Fedora
::Rebuild
::RPM
::ANY
, '', $a, 'a-main']
59 [Fedora
::Rebuild
::RPM
::ANY
, '', $a, 'a-libs']
62 [Fedora
::Rebuild
::RPM
::EQUAL
, '1', $a, 'a-main']
68 my $b = build_package
(
73 [Fedora
::Rebuild
::RPM
::ANY
, '']
76 [Fedora
::Rebuild
::RPM
::EQUAL
, '2']
81 [Fedora
::Rebuild
::RPM
::ANY
, '']
86 ok
(defined $b, 'create package b');
87 $providers->insert($b);
89 $providers->providers(),
92 [Fedora
::Rebuild
::RPM
::ANY
, '', $a, 'a-main']
95 [Fedora
::Rebuild
::RPM
::ANY
, '', $a, 'a-libs']
98 [Fedora
::Rebuild
::RPM
::ANY
, '', $b, 'b-main']
101 [Fedora
::Rebuild
::RPM
::ANY
, '', $b, 'b-libs']
104 [Fedora
::Rebuild
::RPM
::EQUAL
, '1', $a, 'a-main'],
105 [Fedora
::Rebuild
::RPM
::EQUAL
, '2', $b, 'b-main']
111 my @found = $providers->what_provides('x', Fedora
::Rebuild
::RPM
::ANY
, '');
115 'what provides (x *)'
118 @found = $providers->what_provides('a', Fedora
::Rebuild
::RPM
::ANY
, '');
124 'what provides (a *)'
127 @found = $providers->what_provides('dual',
128 Fedora
::Rebuild
::RPM
::EQUAL
|Fedora
::Rebuild
::RPM
::GREATER
, '3');
132 'what provides (dual >= 3)'
135 @found = $providers->what_provides('dual',
136 Fedora
::Rebuild
::RPM
::EQUAL
|Fedora
::Rebuild
::RPM
::GREATER
, '2');
142 'what provides (dual >= 2)'
145 @found = $providers->what_provides('dual',
146 Fedora
::Rebuild
::RPM
::EQUAL
|Fedora
::Rebuild
::RPM
::GREATER
, '1');
153 'what provides (dual >= 1)'