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).


In reply to Re^3: Overcoming 5.10.0 vs 5.38.2 incompatibilities by bliako
in thread Overcoming 5.10.0 vs 5.38.2 incompatibilities by zatlas1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.