|
Lines 1-7
Link Here
|
| 1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
| 2 |
|
2 |
|
| 3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
| 4 |
use Test::More tests => 43; |
4 |
use Test::More tests => 46; |
| 5 |
use C4::Serials qw( GetNextSeq ); |
5 |
use C4::Serials qw( GetNextSeq ); |
| 6 |
|
6 |
|
| 7 |
# TEST CASE 1 - 1 variable, from 1 to 4 |
7 |
# TEST CASE 1 - 1 variable, from 1 to 4 |
|
Lines 222-234
is($seq, 'Z: 12, Y: 8, X: 4');
Link Here
|
| 222 |
$seq = _next_seq($subscription, $pattern); |
222 |
$seq = _next_seq($subscription, $pattern); |
| 223 |
is($seq, 'Z: 1, Y: 1, X: 1'); |
223 |
is($seq, 'Z: 1, Y: 1, X: 1'); |
| 224 |
|
224 |
|
|
|
225 |
# TEST CASE 7 . Specify how many issues to count forward, 1 variable, from 1 to 4 |
| 226 |
|
| 227 |
$subscription = { |
| 228 |
lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, |
| 229 |
innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, |
| 230 |
skip_serialseq => 0, |
| 231 |
irregularity => '', |
| 232 |
locale => 'en', |
| 233 |
}; |
| 234 |
$pattern = { |
| 235 |
add1 => 1, add2 => 0, add3 => 0, |
| 236 |
every1 => 1, every2 => 0, every3 => 0, |
| 237 |
whenmorethan1 => 4, whenmorethan2 => 0, whenmorethan3 => 0, |
| 238 |
setto1 => 1, setto2 => 0, setto3 => 0, |
| 239 |
numberingmethod => 'X: {X}', |
| 240 |
numbering1 => '', |
| 241 |
numbering2 => '', |
| 242 |
numbering3 => '', |
| 243 |
}; |
| 244 |
$seq = _next_seq($subscription, $pattern, 1); |
| 245 |
is($seq, 'X: 2'); |
| 246 |
$seq = _next_seq($subscription, $pattern, 2); |
| 247 |
is($seq, 'X: 4'); |
| 248 |
$seq = _next_seq($subscription, $pattern, 2); |
| 249 |
is($seq, 'X: 2'); |
| 225 |
|
250 |
|
| 226 |
sub _next_seq { |
251 |
sub _next_seq { |
| 227 |
my ($subscription, $pattern) = @_; |
252 |
my ($subscription, $pattern, $count_forward) = @_; |
| 228 |
my $seq; |
253 |
my $seq; |
| 229 |
($seq, $subscription->{lastvalue1}, $subscription->{lastvalue2}, |
254 |
($seq, $subscription->{lastvalue1}, $subscription->{lastvalue2}, |
| 230 |
$subscription->{lastvalue3}, $subscription->{innerloop1}, |
255 |
$subscription->{lastvalue3}, $subscription->{innerloop1}, |
| 231 |
$subscription->{innerloop2}, $subscription->{innerloop3}) = |
256 |
$subscription->{innerloop2}, $subscription->{innerloop3}) = |
| 232 |
GetNextSeq($subscription, $pattern); |
257 |
GetNextSeq($subscription, $pattern, undef, undef, $count_forward); |
| 233 |
return $seq; |
258 |
return $seq; |
| 234 |
} |
259 |
} |
| 235 |
- |
|
|