View | Details | Raw Unified | Return to bug 8486
Collapse All | Expand All

(-)a/t/Calendar.t (-15 / +14 lines)
Lines 106-129 $cal->set_daysmode('Calendar'); Link Here
106
# example tests for bug report
106
# example tests for bug report
107
$cal->clear_weekly_closed_days();
107
$cal->clear_weekly_closed_days();
108
108
109
$daycount = $cal->days_between( dt_from_string('2012-01-10'),
109
$daycount = $cal->days_between( dt_from_string('2012-01-10','iso'),
110
    dt_from_string("2012-05-05") )->in_units('days');
110
    dt_from_string("2012-05-05",'iso') )->in_units('days');
111
cmp_ok( $daycount, '==', 116, 'test larger intervals' );
111
cmp_ok( $daycount, '==', 116, 'test larger intervals' );
112
$daycount = $cal->days_between( dt_from_string("2012-01-01"),
112
$daycount = $cal->days_between( dt_from_string("2012-01-01",'iso'),
113
    dt_from_string("2012-05-05") )->in_units('days');
113
    dt_from_string("2012-05-05",'iso') )->in_units('days');
114
cmp_ok( $daycount, '==', 125, 'test positive intervals' );
114
cmp_ok( $daycount, '==', 125, 'test positive intervals' );
115
my $daycount2 = $cal->days_between( dt_from_string("2012-05-05"),
115
my $daycount2 = $cal->days_between( dt_from_string("2012-05-05",'iso'),
116
    dt_from_string("2012-01-01") )->in_units('days');
116
    dt_from_string("2012-01-01",'iso') )->in_units('days');
117
cmp_ok( $daycount2, '==', $daycount, 'test parameter order not relevant' );
117
cmp_ok( $daycount2, '==', $daycount, 'test parameter order not relevant' );
118
$daycount = $cal->days_between( dt_from_string("2012-07-01"),
118
$daycount = $cal->days_between( dt_from_string("2012-07-01",'iso'),
119
    dt_from_string("2012-07-15") )->in_units('days');
119
    dt_from_string("2012-07-15",'iso') )->in_units('days');
120
cmp_ok( $daycount, '==', 14, 'days_between calculates correctly' );
120
cmp_ok( $daycount, '==', 14, 'days_between calculates correctly' );
121
$cal->add_holiday( dt_from_string('2012-07-06') );
121
$cal->add_holiday( dt_from_string('2012-07-06','iso') );
122
$daycount = $cal->days_between( dt_from_string("2012-07-01"),
122
$daycount = $cal->days_between( dt_from_string("2012-07-01",'iso'),
123
    dt_from_string("2012-07-15") )->in_units('days');
123
    dt_from_string("2012-07-15",'iso') )->in_units('days');
124
cmp_ok( $daycount, '==', 13, 'holiday correctly recognized' );
124
cmp_ok( $daycount, '==', 13, 'holiday correctly recognized' );
125
125
126
$cal->add_holiday( dt_from_string('2012-07-07') );
126
$cal->add_holiday( dt_from_string('2012-07-07','iso') );
127
$daycount = $cal->days_between( dt_from_string("2012-07-01"),
127
$daycount = $cal->days_between( dt_from_string("2012-07-01",'iso'),
128
    dt_from_string("2012-07-15") )->in_units('days');
128
    dt_from_string("2012-07-15",'iso') )->in_units('days');
129
cmp_ok( $daycount, '==', 12, 'multiple holidays correctly recognized' );
129
cmp_ok( $daycount, '==', 12, 'multiple holidays correctly recognized' );
130
- 

Return to bug 8486