in reply to Re^2: Overcoming 5.10.0 vs 5.38.2 incompatibilities
in thread Overcoming 5.10.0 vs 5.38.2 incompatibilities

I do not see in the code where Date::Manip methods are used

I have added some comments to your code so that you understand what the script does, especially with regards to the above:

for my $delta ($delta_time, $delta_date){ # the above are likely to be Date::Manip[::*] objects - which ones???? for my $field (qw (seconds minutes hours days months years)) { for my $type ('','total_') { my $func = "${type}${field}"; # this is the method name to be called via the $delta objects for my $prec ('','trunc') { # this is the a parameter to above method, one is empty on +e is 'trunc' diag ("comapring ".$delta->$func($prec)." to ".$test_value +s[$test_index]." at ".$test_index." func=".$func." prec=".$prec." typ +e=".$type." field=".$field); ok($delta->$func($prec) == $test_values[$test_index++],"$func +($prec) ($delta_text[$delta_index])") # it calls e.g. this: $delta->total_seconds('trunc') # and it compares the returned result with an item from an ar +ray # of expected results $test_values[$test_index]

just do some plain 'ol debugging using common sense and forget about the deltas for the moment.

For example, from your failed tests:

# comapring 571645.000000 to 571645 at 7 func=total_minutes prec=trunc + type=total_ field=minutes # comapring 9527.417778 to 23.417778 at 8 func=hours prec= type= field +=hours # Failed test 'hours() (with time)' # at t/test.t line 97. # Expected 23 got 9527.417778 # comapring 9527 to 23 at 9 func=hours prec=trunc type= field=hours # Failed test 'hours(trunc) (with time)' # at t/test.t line 97. # Expected 9527.417778 got 9527 # comapring 9527.417778 to 9527.417778 at 10 func=total_hours prec= ty +pe=total_ field=hours

it seems that you have 2 issues : the easy one: 9527.417778 got 9527. The other is that probably your expected results got mixed up at  Expected 23 got 9527.417778 especially since 34298704/60 = 571645 and 571645/60 = 9527.4166 you mixed your minutes somewhere along the road...

bw, bliako

Edit: actually for the 1st issue (Expected 9527.417778 got 9527) the deltas may help you. It is likely that at some stage there was a revision in D::M to return only the integer part. In general, when you compare floating point numbers you should not do an exact test but a range test: ok(abs($expected-$got)<1E-09, "yep, they are the same up to 1E-09") (although it would not be helpful in your case).