Bugzilla – Attachment 96786 Details for
Bug 23974
hours_between and days_between lack tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23974: Add test descriptions
Bug-23974-Add-test-descriptions.patch (text/plain), 11.77 KB, created by
Katrin Fischer
on 2020-01-03 06:52:31 UTC
(
hide
)
Description:
Bug 23974: Add test descriptions
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-01-03 06:52:31 UTC
Size:
11.77 KB
patch
obsolete
>From 911e9e93ad8ce08ea98910b4769833909ae2c617 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 2 Dec 2019 09:22:31 +0000 >Subject: [PATCH] Bug 23974: Add test descriptions > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Calendar.t | 88 +++++++++++++++++++++++------------------------ > 1 file changed, 44 insertions(+), 44 deletions(-) > >diff --git a/t/db_dependent/Calendar.t b/t/db_dependent/Calendar.t >index ac5be32c07..0cd6f2a063 100644 >--- a/t/db_dependent/Calendar.t >+++ b/t/db_dependent/Calendar.t >@@ -125,27 +125,27 @@ subtest 'hours_between | days_between' => sub { > > # Between 5th and 6th > my $diff_hours = $calendar->hours_between( $now, $nov_6 )->hours; >- is( $diff_hours, 1 * 24, '' ); >+ is( $diff_hours, 1 * 24, 'hours: 1 day, no holiday' ); > my $diff_days = $calendar->days_between( $now, $nov_6 )->delta_days; >- is( $diff_days, 1, '' ); >+ is( $diff_days, 1, 'days: 1 day, no holiday' ); > > # Between 5th and 7th > $diff_hours = $calendar->hours_between( $now, $nov_7 )->hours; >- is( $diff_hours, 2 * 24, '' ); >+ is( $diff_hours, 2 * 24, 'hours: 2 days, no holiday' ); > $diff_days = $calendar->days_between( $now, $nov_7 )->delta_days; >- is( $diff_days, 2, '' ); >+ is( $diff_days, 2, 'days: 2 days, no holiday' ); > > # Between 5th and 12th > $diff_hours = $calendar->hours_between( $now, $nov_12 )->hours; >- is( $diff_hours, 7 * 24, '' ); >+ is( $diff_hours, 7 * 24, 'hours: 7 days, no holiday' ); > $diff_days = $calendar->days_between( $now, $nov_12 )->delta_days; >- is( $diff_days, 7, '' ); >+ is( $diff_days, 7, 'days: 7 days, no holiday' ); > > # Between 5th and 15th > $diff_hours = $calendar->hours_between( $now, $nov_15 )->hours; >- is( $diff_hours, 10 * 24, '' ); >+ is( $diff_hours, 10 * 24, 'hours: 10 days, no holiday' ); > $diff_days = $calendar->days_between( $now, $nov_15 )->delta_days; >- is( $diff_days, 10, '' ); >+ is( $diff_days, 10, 'days: 10 days, no holiday' ); > }; > > subtest 'Different hours' => sub { >@@ -154,33 +154,33 @@ subtest 'hours_between | days_between' => sub { > > # Between 5th and 5th (Same day short hours loan) > my $diff_hours = $calendar->hours_between( $now, $now->clone->add(hours => 3) )->hours; >- is( $diff_hours, 3, '' ); >+ is( $diff_hours, 3, 'hours: 3 hours, no holidays' ); > my $diff_days = $calendar->days_between( $now, $now->clone->add(hours => 3) )->delta_days; >- is( $diff_days, 0, '' ); >+ is( $diff_days, 0, 'days: 3 hours, no holidays' ); > > # Between 5th and 6th > $diff_hours = $calendar->hours_between( $now, $nov_6->clone->subtract(hours => 3) )->hours; >- is( $diff_hours, 1 * 24 - 3, '' ); >+ is( $diff_hours, 1 * 24 - 3, 'hours: 21 hours, no holidays' ); > $diff_days = $calendar->days_between( $now, $nov_6->clone->subtract(hours => 3) )->delta_days; >- is( $diff_days, 1, '' ); >+ is( $diff_days, 1, 'days: 21 hours, no holidays' ); > > # Between 5th and 7th > $diff_hours = $calendar->hours_between( $now, $nov_7->clone->subtract(hours => 3) )->hours; >- is( $diff_hours, 2 * 24 - 3, '' ); >+ is( $diff_hours, 2 * 24 - 3, 'hours: 45 hours, no holidays' ); > $diff_days = $calendar->days_between( $now, $nov_7->clone->subtract(hours => 3) )->delta_days; >- is( $diff_days, 2, '' ); >+ is( $diff_days, 2, 'days: 45 hours, no holidays' ); > > # Between 5th and 12th > $diff_hours = $calendar->hours_between( $now, $nov_12->clone->subtract(hours => 3) )->hours; >- is( $diff_hours, 7 * 24 - 3, '' ); >+ is( $diff_hours, 7 * 24 - 3, 'hours: 165 hours, no holidays' ); > $diff_days = $calendar->days_between( $now, $nov_12->clone->subtract(hours => 3) )->delta_days; >- is( $diff_days, 7, '' ); >+ is( $diff_days, 7, 'days: 165 hours, no holidays' ); > > # Between 5th and 15th > $diff_hours = $calendar->hours_between( $now, $nov_15->clone->subtract(hours => 3) )->hours; >- is( $diff_hours, 10 * 24 - 3, '' ); >+ is( $diff_hours, 10 * 24 - 3, 'hours: 237 hours, no holidays' ); > $diff_days = $calendar->days_between( $now, $nov_15->clone->subtract(hours => 3) )->delta_days; >- is( $diff_days, 10, '' ); >+ is( $diff_days, 10, 'days: 237 hours, no holidays' ); > }; > }; > >@@ -205,39 +205,39 @@ subtest 'hours_between | days_between' => sub { > > # Between 5th and 6th (This case should never happen in real code, one cannot return on a closed day) > $diff_hours = $calendar->hours_between( $now, $nov_6 )->hours; >- is( $diff_hours, 0 * 24, '' ); # FIXME Is this really should be 0? >+ is( $diff_hours, 0 * 24, 'hours: 1 day, end_dt = holiday' ); # FIXME Is this really should be 0? > $diff_days = $calendar->days_between( $now, $nov_6)->delta_days; >- is( $diff_days, 0, '' ); # FIXME Is this really should be 0? >+ is( $diff_days, 0, 'days: 1 day, end_dt = holiday' ); # FIXME Is this really should be 0? > > # Between 6th and 7th (This case should never happen in real code, one cannot issue on a closed day) > $diff_hours = $calendar->hours_between( $nov_6, $nov_7 )->hours; >- is( $diff_hours, 0 * 24, '' ); # FIXME Is this really should be 0? >+ is( $diff_hours, 0 * 24, 'hours: 1 day, start_dt = holiday' ); # FIXME Is this really should be 0? > $diff_days = $calendar->days_between( $nov_6, $nov_7 )->delta_days; >- is( $diff_days, 0, '' ); # FIXME Is this really should be 0? >+ is( $diff_days, 0, 'days: 1 day, start_dt = holiday' ); # FIXME Is this really should be 0? > > # Between 5th and 7th > $diff_hours = $calendar->hours_between( $now, $nov_7 )->hours; >- is( $diff_hours, 2 * 24 - 1 * 24, '' ); >+ is( $diff_hours, 2 * 24 - 1 * 24, 'hours: 2 days, 1 holiday' ); > $diff_days = $calendar->days_between( $now, $nov_7 )->delta_days; >- is( $diff_days, 2 - 1, '' ); >+ is( $diff_days, 2 - 1, 'days: 2 days, 1 holiday' ); > > # Between 5th and 12th > $diff_hours = $calendar->hours_between( $now, $nov_12 )->hours; >- is( $diff_hours, 7 * 24 - 1 * 24, '' ); >+ is( $diff_hours, 7 * 24 - 1 * 24, 'hours: 7 days, 1 holiday' ); > $diff_days = $calendar->days_between( $now, $nov_12)->delta_days; >- is( $diff_days, 7 - 1, '' ); >+ is( $diff_days, 7 - 1, 'day: 7 days, 1 holiday' ); > > # Between 5th and 13th > $diff_hours = $calendar->hours_between( $now, $nov_13 )->hours; >- is( $diff_hours, 8 * 24 - 2 * 24, '' ); >+ is( $diff_hours, 8 * 24 - 2 * 24, 'hours: 8 days, 2 holidays' ); > $diff_days = $calendar->days_between( $now, $nov_13)->delta_days; >- is( $diff_days, 8 - 2, '' ); >+ is( $diff_days, 8 - 2, 'days: 8 days, 2 holidays' ); > > # Between 5th and 15th > $diff_hours = $calendar->hours_between( $now, $nov_15 )->hours; >- is( $diff_hours, 10 * 24 - 2 * 24, '' ); >+ is( $diff_hours, 10 * 24 - 2 * 24, 'hours: 10 days, 2 holidays' ); > $diff_days = $calendar->days_between( $now, $nov_15)->delta_days; >- is( $diff_days, 10 - 2, '' ); >+ is( $diff_days, 10 - 2, 'days: 10 days, 2 holidays' ); > }; > > subtest 'Different hours' => sub { >@@ -250,41 +250,41 @@ subtest 'hours_between | days_between' => sub { > > # Between 5th and 6th (This case should never happen in real code, one cannot return on a closed day) > my $duration = $calendar->hours_between( $now, $nov_6->clone->subtract(hours => 3) ); >- is( $duration->hours, abs(0 * 24 - 3), '' ); # FIXME $duration->hours always return a abs >- is( $duration->is_negative, 1, ); # FIXME Do really test for that case in our calls to hours_between? >+ is( $duration->hours, abs(0 * 24 - 3), 'hours: 21 hours, end_dt = holiday' ); # FIXME $duration->hours always return a abs >+ is( $duration->is_negative, 1, '? is negative ?' ); # FIXME Do really test for that case in our calls to hours_between? > $duration = $calendar->days_between( $now, $nov_6->clone->subtract(hours => 3) ); >- is( $duration->hours, abs(0), '' ); # FIXME Is this correct? >+ is( $duration->hours, abs(0), 'days: 21 hours, end_dt = holiday' ); # FIXME Is this correct? > > # Between 6th and 7th (This case should never happen in real code, one cannot issue on a closed day) > $duration = $calendar->hours_between( $nov_6, $nov_7->clone->subtract(hours => 3) ); >- is( $duration->hours, abs(0 * 24 - 3), '' ); # FIXME $duration->hours always return a abs >- is( $duration->is_negative, 1, ); # FIXME Do really test for that case in our calls to hours_between? >+ is( $duration->hours, abs(0 * 24 - 3), 'hours: 21 hours, start_dt = holiday' ); # FIXME $duration->hours always return a abs >+ is( $duration->is_negative, 1, '? is negative ?' ); # FIXME Do really test for that case in our calls to hours_between? > $duration = $calendar->days_between( $nov_6, $nov_7->clone->subtract(hours => 3) ); >- is( $duration->hours, abs(0), '' ); # FIXME Is this correct? >+ is( $duration->hours, abs(0), 'days: 21 hours, start_dt = holiday' ); # FIXME Is this correct? > > # Between 5th and 7th > $diff_hours = $calendar->hours_between( $now, $nov_7->clone->subtract(hours => 3) )->hours; >- is( $diff_hours, 2 * 24 - 1 * 24 - 3, '' ); >+ is( $diff_hours, 2 * 24 - 1 * 24 - 3, 'hours: 45 hours, 1 holiday' ); > $diff_days = $calendar->days_between( $now, $nov_7->clone->subtract(hours => 3) )->delta_days; >- is( $diff_days, 2 - 1, '' ); >+ is( $diff_days, 2 - 1, 'days: 45 hours, 1 holiday' ); > > # Between 5th and 12th > $diff_hours = $calendar->hours_between( $now, $nov_12->clone->subtract(hours => 3) )->hours; >- is( $diff_hours, 7 * 24 - 1 * 24 - 3, '' ); >+ is( $diff_hours, 7 * 24 - 1 * 24 - 3, 'hours: 165 hours, 1 holiday' ); > $diff_days = $calendar->days_between( $now, $nov_12->clone->subtract(hours => 3) )->delta_days; >- is( $diff_days, 7 - 1, '' ); >+ is( $diff_days, 7 - 1, 'days: 165 hours, 1 holiday' ); > > # Between 5th and 13th > $diff_hours = $calendar->hours_between( $now, $nov_13->clone->subtract(hours => 3) )->hours; >- is( $diff_hours, 8 * 24 - 2 * 24 - 3, '' ); >+ is( $diff_hours, 8 * 24 - 2 * 24 - 3, 'hours: 289 hours, 2 holidays ' ); > $diff_days = $calendar->days_between( $now, $nov_13->clone->subtract(hours => 3) )->delta_days; >- is( $diff_days, 8 - 1, '' ); >+ is( $diff_days, 8 - 1, 'days: 289 hours, 2 holidays' ); > > # Between 5th and 15th > $diff_hours = $calendar->hours_between( $now, $nov_15->clone->subtract(hours => 3) )->hours; >- is( $diff_hours, 10 * 24 - 2 * 24 - 3, '' ); >+ is( $diff_hours, 10 * 24 - 2 * 24 - 3, 'hours: 237 hours, 2 holidays' ); > $diff_days = $calendar->days_between( $now, $nov_15->clone->subtract(hours => 3) )->delta_days; >- is( $diff_days, 10 - 2, '' ); >+ is( $diff_days, 10 - 2, 'days: 237 hours, 2 holidays' ); > }; > > }; >-- >2.11.0
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 23974
:
95062
|
95063
|
95064
|
95065
|
95210
|
95211
|
95212
|
95213
|
95214
|
95889
|
95890
|
95891
|
95893
|
95894
|
95895
|
95896
|
96778
|
96779
|
96780
|
96781
|
96782
|
96783
|
96784
|
96785
|
96786
|
97129
|
97130
|
97131
|
97132
|
97133
|
97134
|
97135
|
97136
|
97137