in reply to Re^2: How to write testable command line script?
in thread How to write testable command line script?
... 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: <%-{-{-{-<
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: How to write testable command line script?
by thechartist (Monk) on Nov 26, 2018 at 02:15 UTC | |
by pryrt (Abbot) on Nov 26, 2018 at 15:02 UTC | |
by thechartist (Monk) on Nov 26, 2018 at 15:16 UTC | |
by AnomalousMonk (Archbishop) on Nov 26, 2018 at 16:36 UTC | |
by thechartist (Monk) on Nov 26, 2018 at 17:47 UTC | |
| |
by thechartist (Monk) on Nov 26, 2018 at 16:57 UTC | |
| |
by pryrt (Abbot) on Nov 26, 2018 at 17:17 UTC | |
by thechartist (Monk) on Nov 27, 2018 at 04:43 UTC | |
| |
by thechartist (Monk) on Nov 26, 2018 at 17:51 UTC | |
|