Skip to content

Instantly share code, notes, and snippets.

@danslimmon
Created March 5, 2014 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danslimmon/9370521 to your computer and use it in GitHub Desktop.
Save danslimmon/9370521 to your computer and use it in GitHub Desktop.
Test cases for converting a floating-point number of degrees to the format DDDMM.MMM where 'DDD' is the up-to-three-digit number of degrees and 'MM.MMM' is the 0-padded number of minutes to exactly three decimal places.
test_cases = [
{'in': (31.21972,), 'out': '3113.183'},
{'in': (149.999999,), 'out': '15000.000'},
{'in': (-179.999999,), 'out': '18000.000'},
{'in': (-7.000991,), 'out': '-0700.059'},
{'in': (3.141593,), 'out': '0308.496'},
{'in': (0.0,), 'out': '0000.000'},
{'in': (-0.999999,), 'out': '-0100.000'},
{'in': (-86.83141,), 'out': '-8649.885'},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment