mixed_units.nbt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # Degrees, minutes, seconds (DMS)
  2. ## United states capitol coordinates
  3. assert_eq(38° + 53′ + 23″, 38.8897°, 1e-4°)
  4. assert_eq(-(77° + 0′ + 32″), -77.0089°, 1e-4°)
  5. assert_eq(38.8897° -> DMS, "38° 53′ 23″")
  6. assert_eq(-77.0089° -> DMS, "-77° 0′ 32″")
  7. ## Stuttgart
  8. assert_eq(48° + 46′ + 32″, 48.7756°, 1e-4°)
  9. assert_eq(9° + 10′ + 58″, 9.1828°, 1e-4°)
  10. assert_eq(48.7756° -> DMS, "48° 46′ 32″")
  11. assert_eq(9.1828° -> DMS, "9° 10′ 58″")
  12. # Degrees, decimal minutes (DM)
  13. assert_eq(38.8897° -> DM, "38° 53.382′")
  14. assert_eq(-77.0089° -> DM, "-77° 0.534′")
  15. # Feet and inches
  16. assert_eq(5.5 ft -> feet_and_inches, "5 ft 6 in")
  17. assert_eq(6.75 ft -> feet_and_inches, "6 ft 9 in")
  18. assert_eq(-5.5 ft -> feet_and_inches, "-5 ft 6 in")
  19. assert_eq(0 -> feet_and_inches, "0 ft 0 in")
  20. assert_eq(1 ft -> feet_and_inches, "1 ft 0 in")
  21. assert_eq(2.345 inch -> feet_and_inches, "0 ft 2.345 in")
  22. # Pounds and ounces
  23. assert_eq(5 lb -> pounds_and_ounces, "5 lb 0 oz")
  24. assert_eq(5.5 lb -> pounds_and_ounces, "5 lb 8 oz")
  25. assert_eq(6.75 lb -> pounds_and_ounces, "6 lb 12 oz")
  26. assert_eq(-5.5 lb -> pounds_and_ounces, "-5 lb 8 oz")