Skip to content

Commit

Permalink
Update mixed-unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Goju-Ryu committed Sep 29, 2024
1 parent 136114f commit 7be6aef
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions examples/tests/mixed_units.nbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@
assert_eq(38° + 53′ + 23″, 38.8897°, 1e-4°)
assert_eq(-(77° + 0′ + 32″), -77.0089°, 1e-4°)

assert_eq(38.8897° -> DMS, "38° 53′ 23″")
assert_eq(-77.0089° -> DMS, "-77° 0′ 32″")
assert_eq("{38.88972222° -> DMS}", "{[38°, 53′, 23″]}")
assert_eq("{-77.0089° -> DMS}", "{[-77°, -0′, -32.04″]}")

## Stuttgart
assert_eq(48° + 46′ + 32″, 48.7756°, 1e-4°)
assert_eq(9° + 10′ + 58″, 9.1828°, 1e-4°)

assert_eq(48.7756° -> DMS, "48° 46′ 32″")
assert_eq(9.1828° -> DMS, " 10′ 58″")
assert_eq("{48.775555555° -> DMS}", "{[48°, 46′, 32″]}")
assert_eq("{9.18277777° -> DMS}", "{[9°, 10′, 58″]}")

# Degrees, decimal minutes (DM)

assert_eq(38.8897° -> DM, "38° 53.382′")
assert_eq(-77.0089° -> DM, "-77° 0.534′")
assert_eq("{38.8897° -> DM}", "{[38°, 53.382′]}")
assert_eq("{-77.0089° -> DM}", "{[-77°, -0.534′]}")

# Feet and inches

assert_eq(5.5 ft -> feet_and_inches, "5 ft 6 in")
assert_eq(6.75 ft -> feet_and_inches, "6 ft 9 in")
assert_eq(-5.5 ft -> feet_and_inches, "-5 ft 6 in")
assert_eq(0 -> feet_and_inches, "0 ft 0 in")
assert_eq(1 ft -> feet_and_inches, "1 ft 0 in")
assert_eq(2.345 inch -> feet_and_inches, "0 ft 2.345 in")
assert_eq("{5.5 ft -> feet_and_inches}", "{[5 ft, 6 in]}")
assert_eq("{6.75 ft -> feet_and_inches}", "{[6 ft, 9 in]}")
assert_eq("{-5.5 ft -> feet_and_inches}", "{[-5 ft, -6 in]}")
assert_eq("{0 -> feet_and_inches}", "{[0 ft, 0 in]}")
assert_eq("{1 ft -> feet_and_inches}", "{[1 ft, 0 in]}")
assert_eq("{2.345 inch -> feet_and_inches}", "{[0 ft, 2.345 in]}")

# Pounds and ounces

assert_eq(5 lb -> pounds_and_ounces, "5 lb 0 oz")
assert_eq(5.5 lb -> pounds_and_ounces, "5 lb 8 oz")
assert_eq(6.75 lb -> pounds_and_ounces, "6 lb 12 oz")
assert_eq(-5.5 lb -> pounds_and_ounces, "-5 lb 8 oz")
assert_eq("{5 lb -> pounds_and_ounces}", "{[5 lb, 0 oz]}")
assert_eq("{5.5 lb -> pounds_and_ounces}", "{[5 lb, 8 oz]}")
assert_eq("{6.75 lb -> pounds_and_ounces}", "{[6 lb, 12 oz]}")
assert_eq("{-5.5 lb -> pounds_and_ounces}", "{[-5 lb, -8 oz]}")

# Unit list

Expand Down

0 comments on commit 7be6aef

Please sign in to comment.