Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
... the initial goal of getting the tests to run has been met.

I'm looking at your  $test_7: (0, 0, -60) -> (-1, 59, 0) (result: -1° 59' 0"). (There's a similar test 7 here with result (-1, 59, 2).) I would have thought the normalized or reduced result to be  (0 -1 0) (0° -1' 0"). If the required result shown in the code is correct, it suggests a set of sign propagation rules I have yet to see. Can you expand on this?

I notice that you haven't recast your core code into a module yet. Doing so is a good idea for many reasons, including testing. Note that Test::More::use_ok() is available for modules and Test::More::require_ok() for more humble files.

The other point that occurred to me is also in terms of general design. Rather than always reduce()-ing deg/min/sec tuples to other d/m/s tuples, it might be less of a headache to normalize d/m/s tuples to, say, integer or decimal fraction arc-seconds (or maybe radians?) or whatever's most convenient, do all the trig in these standard units, then convert back to the ultimate d/m/s (or whatever) output form just once as a final step. Just a thought...


Give a man a fish:  <%-{-{-{-<


In reply to Re^3: How to write testable command line script? by AnomalousMonk
in thread How to write testable command line script? by thechartist

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-26 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found