Bugzilla – Attachment 171500 Details for
Bug 37796
Generated issue has incorrect number in pattern when receiving
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37796: Adjust GetNextSeq unit test file
Bug-37796-Adjust-GetNextSeq-unit-test-file.patch (text/plain), 22.93 KB, created by
Nick Clemens (kidclamp)
on 2024-09-13 20:09:27 UTC
(
hide
)
Description:
Bug 37796: Adjust GetNextSeq unit test file
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-09-13 20:09:27 UTC
Size:
22.93 KB
patch
obsolete
>From 4dc88647f668b1079982639a33bd0242b6d69525 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 13 Sep 2024 20:02:14 +0000 >Subject: [PATCH] Bug 37796: Adjust GetNextSeq unit test file > >The crux of the change here was adding an extra param to the call, but when it died >I had no idea where it did. Taking the liberty to tidy, move to subtests, and add diag >--- > t/Serials/GetNextSeq.t | 486 ++++++++++++++++++++++------------------- > 1 file changed, 258 insertions(+), 228 deletions(-) > >diff --git a/t/Serials/GetNextSeq.t b/t/Serials/GetNextSeq.t >index 63a7f3c73ec..3ffe6db2501 100755 >--- a/t/Serials/GetNextSeq.t >+++ b/t/Serials/GetNextSeq.t >@@ -1,259 +1,289 @@ > #!/usr/bin/perl > > use Modern::Perl; >-use Test::More tests => 46; >+use Test::More tests => 7; > use C4::Serials qw( GetNextSeq ); > >-# TEST CASE 1 - 1 variable, from 1 to 4 >-my $subscription = { >- lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, >- innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >- skip_serialseq => 0, >- irregularity => '', >- locale => 'en', >-}; >-my $pattern = { >- add1 => 1, add2 => 0, add3 => 0, >- every1 => 1, every2 => 0, every3 => 0, >- whenmorethan1 => 4, whenmorethan2 => 0, whenmorethan3 => 0, >- setto1 => 1, setto2 => 0, setto3 => 0, >- numberingmethod => 'X: {X}', >- numbering1 => '', >- numbering2 => '', >- numbering3 => '', >-}; >+subtest "TEST CASE 1 - 1 variable, from 1 to 4" => sub { >+ plan tests => 5; > >-my $seq = _next_seq($subscription, $pattern); >-is($seq, 'X: 2'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'X: 3'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'X: 4'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'X: 1'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'X: 2'); >+ my $subscription = { >+ lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, >+ innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >+ skip_serialseq => 0, >+ irregularity => '', >+ locale => 'en', >+ }; >+ my $pattern = { >+ add1 => 1, add2 => 0, add3 => 0, >+ every1 => 1, every2 => 0, every3 => 0, >+ whenmorethan1 => 4, whenmorethan2 => 0, whenmorethan3 => 0, >+ setto1 => 1, setto2 => 0, setto3 => 0, >+ numberingmethod => 'X: {X}', >+ numbering1 => '', >+ numbering2 => '', >+ numbering3 => '', >+ }; >+ >+ my $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'X: 2', "X is increased for next issue" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'X: 3', "X is increased again" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'X: 4', "X is increased again" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'X: 1', "X reset when crossing the 'whenmorethan' threshold" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'X: 2', "X continues to increase correctly after reset" ); > >-# TEST CASE 2 - 1 variable, use 'dayname' numbering, from 1 to 7 >-$subscription = { >- lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, >- innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >- skip_serialseq => 0, >- irregularity => '', >- locale => 'C', >-}; >-$pattern = { >- add1 => 1, add2 => 1, add3 => 0, >- every1 => 1, every2 => 1, every3 => 0, >- whenmorethan1 => 7, whenmorethan2 => 7, whenmorethan3 => 0, >- setto1 => 1, setto2 => 1, setto3 => 0, >- numberingmethod => 'dayname: {X} | dayabrv: {Y}', >- numbering1 => 'dayname', >- numbering2 => 'dayabrv', >- numbering3 => '', > }; > >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'dayname: Tuesday | dayabrv: Tue'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'dayname: Wednesday | dayabrv: Wed'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'dayname: Thursday | dayabrv: Thu'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'dayname: Friday | dayabrv: Fri'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'dayname: Saturday | dayabrv: Sat'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'dayname: Sunday | dayabrv: Sun'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'dayname: Monday | dayabrv: Mon'); >+subtest "TEST CASE 2 - 1 variable, use 'dayname' numbering, from 1 to 7" => sub { >+ plan tests => 7; >+ my $subscription = { >+ lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, >+ innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >+ skip_serialseq => 0, >+ irregularity => '', >+ locale => 'C', >+ }; >+ my $pattern = { >+ add1 => 1, add2 => 1, add3 => 0, >+ every1 => 1, every2 => 1, every3 => 0, >+ whenmorethan1 => 7, whenmorethan2 => 7, whenmorethan3 => 0, >+ setto1 => 1, setto2 => 1, setto3 => 0, >+ numberingmethod => 'dayname: {X} | dayabrv: {Y}', >+ numbering1 => 'dayname', >+ numbering2 => 'dayabrv', >+ numbering3 => '', >+ }; > >-# TEST CASE 3 - 1 variable, use 'monthname' numbering, from 0 to 11 by step of 2 >-$subscription = { >- lastvalue1 => 0, lastvalue2 => 0, lastvalue3 => 0, >- innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >- skip_serialseq => 0, >- irregularity => '', >- locale => 'C', # locale set to 'C' to ensure we'll have english strings >-}; >-$pattern = { >- add1 => 2, add2 => 2, add3 => 0, >- every1 => 1, every2 => 1, every3 => 0, >- whenmorethan1 => 11, whenmorethan2 => 11, whenmorethan3 => 0, >- setto1 => 0, setto2 => 0, setto3 => 0, >- numberingmethod => 'monthname: {X} | monthabrv: {Y}', >- numbering1 => 'monthname', >- numbering2 => 'monthabrv', >- numbering3 => '', >+ my $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'dayname: Tuesday | dayabrv: Tue', "Day name is correctly generated for second day" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'dayname: Wednesday | dayabrv: Wed', "Day name is correctly generated for third day" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'dayname: Thursday | dayabrv: Thu', "Day name is correctly generated for fourth day" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'dayname: Friday | dayabrv: Fri', "Day name is correctly generated for fifth day" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'dayname: Saturday | dayabrv: Sat', "Day name is correctly generated for sixth day" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'dayname: Sunday | dayabrv: Sun', "Day name is correctly generated for seventh day" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( >+ $seq, 'dayname: Monday | dayabrv: Mon', >+ "Day is correctly reset and name is correctly generated for first day" >+ ); > }; > >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'monthname: March | monthabrv: Mar'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'monthname: May | monthabrv: May'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'monthname: July | monthabrv: Jul'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'monthname: September | monthabrv: Sep'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'monthname: November | monthabrv: Nov'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'monthname: January | monthabrv: Jan'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'monthname: March | monthabrv: Mar'); >+subtest "TEST CASE 3 - 1 variable, use 'monthname' numbering, from 0 to 11 by step of 2" => sub { >+ plan tests => 7; >+ my $subscription = { >+ lastvalue1 => 0, lastvalue2 => 0, lastvalue3 => 0, >+ innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >+ skip_serialseq => 0, >+ irregularity => '', >+ locale => 'C', # locale set to 'C' to ensure we'll have english strings >+ }; >+ my $pattern = { >+ add1 => 2, add2 => 2, add3 => 0, >+ every1 => 1, every2 => 1, every3 => 0, >+ whenmorethan1 => 11, whenmorethan2 => 11, whenmorethan3 => 0, >+ setto1 => 0, setto2 => 0, setto3 => 0, >+ numberingmethod => 'monthname: {X} | monthabrv: {Y}', >+ numbering1 => 'monthname', >+ numbering2 => 'monthabrv', >+ numbering3 => '', >+ }; > >-# TEST CASE 4 - 1 variable, use 'season' numbering, from 0 to 3 >-# Months starts at 0, this implies subscription's lastvalue1 should be 0, >-# together with setto1 and whenmorethan1 should be 11 >-$subscription = { >- lastvalue1 => 0, lastvalue2 => 0, lastvalue3 => 0, >- innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >- skip_serialseq => 0, >- irregularity => '', >- locale => 'C', # locale set to 'C' to ensure we'll have english strings >-}; >-$pattern = { >- add1 => 1, add2 => 1, add3 => 0, >- every1 => 1, every2 => 1, every3 => 0, >- whenmorethan1 => 3, whenmorethan2 => 3, whenmorethan3 => 0, >- setto1 => 0, setto2 => 0, setto3 => 0, >- numberingmethod => 'season: {X} | seasonabrv: {Y}', >- numbering1 => 'season', >- numbering2 => 'seasonabrv', >- numbering3 => '', >+ my $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'monthname: March | monthabrv: Mar', "Next month (3) is correctly generated when adding 2" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'monthname: May | monthabrv: May', "Next month (5) is correctly generated when adding 2" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'monthname: July | monthabrv: Jul', "Next month (7) is correctly generated when adding 2" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'monthname: September | monthabrv: Sep', "Next month (9) is correctly generated when adding 2" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'monthname: November | monthabrv: Nov', "Next month (11) is correctly generated when adding 2" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'monthname: January | monthabrv: Jan', "Next month (1) is correctly reset and generated when adding 2" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'monthname: March | monthabrv: Mar', "Next month (3) is correctly generated when adding 2" ); > }; > >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'season: Summer | seasonabrv: Sum'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'season: Fall | seasonabrv: Fal'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'season: Winter | seasonabrv: Win'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'season: Spring | seasonabrv: Spr'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'season: Summer | seasonabrv: Sum'); >+subtest "TEST CASE 4 - 1 variable, use 'season' numbering, from 0 to 3" => sub { >+ plan tests => 5; > >-# TEST CASE 5 - 2 variables, from 1 to 12, and from 1 to 4 >-$subscription = { >- lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, >- innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >- skip_serialseq => 0, >- irregularity => '', >- locale => 'C', # locale set to 'C' to ensure we'll have english strings >-}; >-$pattern = { >- add1 => 1, add2 => 1, add3 => 0, >- every1 => 1, every2 => 4, every3 => 0, >- whenmorethan1 => 4, whenmorethan2 => 12, whenmorethan3 => 0, >- setto1 => 1, setto2 => 1, setto3 => 0, >- numberingmethod => 'Y: {Y}, X: {X}', >- numbering1 => '', >- numbering2 => '', >- numbering3 => '', >+ # Months starts at 0, this implies subscription's lastvalue1 should be 0, >+ # together with setto1 and whenmorethan1 should be 11 >+ my $subscription = { >+ lastvalue1 => 0, lastvalue2 => 0, lastvalue3 => 0, >+ innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >+ skip_serialseq => 0, >+ irregularity => '', >+ locale => 'C', # locale set to 'C' to ensure we'll have english strings >+ }; >+ my $pattern = { >+ add1 => 1, add2 => 1, add3 => 0, >+ every1 => 1, every2 => 1, every3 => 0, >+ whenmorethan1 => 3, whenmorethan2 => 3, whenmorethan3 => 0, >+ setto1 => 0, setto2 => 0, setto3 => 0, >+ numberingmethod => 'season: {X} | seasonabrv: {Y}', >+ numbering1 => 'season', >+ numbering2 => 'seasonabrv', >+ numbering3 => '', >+ }; >+ >+ my $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'season: Summer | seasonabrv: Sum', "Next season (Summer) is correctly generated" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'season: Fall | seasonabrv: Fal', "Next season (Fall) is correctly generated" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'season: Winter | seasonabrv: Win', "Next season (Winter) is correctly generated" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'season: Spring | seasonabrv: Spr', "Next season (Spring) is correctly reset and generated" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'season: Summer | seasonabrv: Sum', "Next season (Summer) is correctly generated" ); > }; > >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Y: 1, X: 2'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Y: 1, X: 3'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Y: 1, X: 4'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Y: 2, X: 1'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Y: 2, X: 2'); >-# Back to the future >-for (1..39) { >- $seq = _next_seq($subscription, $pattern); >-} >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Y: 12, X: 2'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Y: 12, X: 3'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Y: 12, X: 4'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Y: 1, X: 1'); >+subtest "TEST CASE 5 - 2 variables, from 1 to 12, and from 1 to 4" => sub { >+ plan tests => 9; >+ my $subscription = { >+ lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, >+ innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >+ skip_serialseq => 0, >+ irregularity => '', >+ locale => 'C', # locale set to 'C' to ensure we'll have english strings >+ }; >+ my $pattern = { >+ add1 => 1, add2 => 1, add3 => 0, >+ every1 => 1, every2 => 4, every3 => 0, >+ whenmorethan1 => 4, whenmorethan2 => 12, whenmorethan3 => 0, >+ setto1 => 1, setto2 => 1, setto3 => 0, >+ numberingmethod => 'Y: {Y}, X: {X}', >+ numbering1 => '', >+ numbering2 => '', >+ numbering3 => '', >+ }; > >-# TEST CASE 6 - 3 variables, from 1 to 12, from 1 to 8, and from 1 to 4 >-$subscription = { >- lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, >- innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >- skip_serialseq => 0, >- irregularity => '', >- locale => 'C', # locale set to 'C' to ensure we'll have english strings >-}; >-$pattern = { >- add1 => 1, add2 => 1, add3 => 1, >- every1 => 1, every2 => 4, every3 => 32, >- whenmorethan1 => 4, whenmorethan2 => 8, whenmorethan3 => 12, >- setto1 => 1, setto2 => 1, setto3 => 1, >- numberingmethod => 'Z: {Z}, Y: {Y}, X: {X}', >- numbering1 => '', >- numbering2 => '', >- numbering3 => '', >+ my $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Y: 1, X: 2', "X increased to 2" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Y: 1, X: 3', "X increased to 3" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Y: 1, X: 4', "X increased to 4" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Y: 2, X: 1', "X increased and reset to 1" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Y: 2, X: 2', "X increased to 2" ); >+ >+ # Back to the future >+ for ( 1 .. 39 ) { >+ $seq = _next_seq( $subscription, $pattern ); >+ } >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Y: 12, X: 2', "Skipping ahead, Y has incremented to 12, X increased to 2" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Y: 12, X: 3', "X increased to 3" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Y: 12, X: 4', "X increased to 4" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Y: 1, X: 1', "Y resets after 12, X increased and reset to 1" ); > }; > >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Z: 1, Y: 1, X: 2'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Z: 1, Y: 1, X: 3'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Z: 1, Y: 1, X: 4'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Z: 1, Y: 2, X: 1'); >-for (1..24) { >- $seq = _next_seq($subscription, $pattern); >-} >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Z: 1, Y: 8, X: 2'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Z: 1, Y: 8, X: 3'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Z: 1, Y: 8, X: 4'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Z: 2, Y: 1, X: 1'); >-for (1..350) { >- $seq = _next_seq($subscription, $pattern); >-} >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Z: 12, Y: 8, X: 4'); >-$seq = _next_seq($subscription, $pattern); >-is($seq, 'Z: 1, Y: 1, X: 1'); >+subtest "TEST CASE 6 - 3 variables, from 1 to 12, from 1 to 8, and from 1 to 4" => sub { >+ plan tests => 10; >+ my $subscription = { >+ lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, >+ innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >+ skip_serialseq => 0, >+ irregularity => '', >+ locale => 'C', # locale set to 'C' to ensure we'll have english strings >+ }; >+ my $pattern = { >+ add1 => 1, add2 => 1, add3 => 1, >+ every1 => 1, every2 => 4, every3 => 32, >+ whenmorethan1 => 4, whenmorethan2 => 8, whenmorethan3 => 12, >+ setto1 => 1, setto2 => 1, setto3 => 1, >+ numberingmethod => 'Z: {Z}, Y: {Y}, X: {X}', >+ numbering1 => '', >+ numbering2 => '', >+ numbering3 => '', >+ }; >+ >+ my $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Z: 1, Y: 1, X: 2', "X increased by one, now 2" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Z: 1, Y: 1, X: 3', "X increased by one, now 3" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Z: 1, Y: 1, X: 4', "X increased by one, now 4" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Z: 1, Y: 2, X: 1', "X increased by one, now 1, Y increased by 1, now 2" ); > >-# TEST CASE 7 . Specify how many issues to count forward, 1 variable, from 1 to 4 >+ for ( 1 .. 24 ) { >+ $seq = _next_seq( $subscription, $pattern ); >+ } >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Z: 1, Y: 8, X: 2', "Skipped to Z1, Y8, X2, X increased by one, now 2" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Z: 1, Y: 8, X: 3', "X increased by one, now 3" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Z: 1, Y: 8, X: 4', "X increased by one, now 4" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( >+ $seq, 'Z: 2, Y: 1, X: 1', >+ "X increased by one and reset, now 1. Y increased by 1 and reset, now 1. Z increased by one, now 2" >+ ); > >-$subscription = { >- lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, >- innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >- skip_serialseq => 0, >- irregularity => '', >- locale => 'en', >+ for ( 1 .. 350 ) { >+ $seq = _next_seq( $subscription, $pattern ); >+ } >+ $seq = _next_seq( $subscription, $pattern ); >+ is( $seq, 'Z: 12, Y: 8, X: 4', "Skipped to Z12, Y8, X4, X increased by one, now 4" ); >+ $seq = _next_seq( $subscription, $pattern ); >+ is( >+ $seq, 'Z: 1, Y: 1, X: 1', >+ "X increased by one and reset, now 1. Y increased by 1 and reset, now 1. Z increased by one and reset, now 1" >+ ); > }; >-$pattern = { >- add1 => 1, add2 => 0, add3 => 0, >- every1 => 1, every2 => 0, every3 => 0, >- whenmorethan1 => 4, whenmorethan2 => 0, whenmorethan3 => 0, >- setto1 => 1, setto2 => 0, setto3 => 0, >- numberingmethod => 'X: {X}', >- numbering1 => '', >- numbering2 => '', >- numbering3 => '', >+ >+subtest "TEST CASE 7 . Specify how many issues to count forward, 1 variable, from 1 to 4" => sub { >+ plan tests => 3; >+ >+ my $subscription = { >+ lastvalue1 => 1, lastvalue2 => 1, lastvalue3 => 1, >+ innerloop1 => 0, innerloop2 => 0, innerloop3 => 0, >+ skip_serialseq => 0, >+ irregularity => '', >+ locale => 'en', >+ }; >+ my $pattern = { >+ add1 => 1, add2 => 0, add3 => 0, >+ every1 => 1, every2 => 0, every3 => 0, >+ whenmorethan1 => 4, whenmorethan2 => 0, whenmorethan3 => 0, >+ setto1 => 1, setto2 => 0, setto3 => 0, >+ numberingmethod => 'X: {X}', >+ numbering1 => '', >+ numbering2 => '', >+ numbering3 => '', >+ }; >+ my $seq = _next_seq( $subscription, $pattern, 1 ); >+ is( $seq, 'X: 2', "When counting forward 1, X increased by one" ); >+ $seq = _next_seq( $subscription, $pattern, 2 ); >+ is( $seq, 'X: 4', "When counting forward 2, X increased by 2" ); >+ $seq = _next_seq( $subscription, $pattern, 2 ); >+ is( $seq, 'X: 2', "When counting forward 2, X correctly reset and counted forward by 2" ); > }; >-$seq = _next_seq($subscription, $pattern, 1); >-is($seq, 'X: 2'); >-$seq = _next_seq($subscription, $pattern, 2); >-is($seq, 'X: 4'); >-$seq = _next_seq($subscription, $pattern, 2); >-is($seq, 'X: 2'); > > sub _next_seq { >- my ($subscription, $pattern, $count_forward) = @_; >+ my ( $subscription, $pattern, $count_forward ) = @_; > my $seq; >- ($seq, $subscription->{lastvalue1}, $subscription->{lastvalue2}, >+ ( >+ $seq, $subscription->{lastvalue1}, $subscription->{lastvalue2}, > $subscription->{lastvalue3}, $subscription->{innerloop1}, >- $subscription->{innerloop2}, $subscription->{innerloop3}) = >- GetNextSeq($subscription, $pattern, undef, undef, $count_forward); >+ $subscription->{innerloop2}, $subscription->{innerloop3} >+ ) = GetNextSeq( $subscription, $pattern, undef, undef, undef, $count_forward ); > return $seq; > } >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37796
:
170927
|
171498
|
171499
| 171500