Skip to content

Commit

Permalink
Impact test with new format
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinLeTallec committed Jul 13, 2024
1 parent e1a7f80 commit 78d94cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 54 deletions.
45 changes: 0 additions & 45 deletions examples/datetime_human_tests.nbt

This file was deleted.

25 changes: 16 additions & 9 deletions examples/tests/human.nbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
assert_eq((0 second -> human), "0 seconds")
assert_eq((1 second -> human), "1 second")
assert_eq((5 second -> human), "5 seconds")
assert_eq((1.5 second -> human), "1.500 seconds")
assert_eq((1.5 second -> human), "1.5 seconds")

assert_eq((60 seconds -> human), "1 minute")
assert_eq((73 seconds -> human), "1 minute + 13 seconds")
assert_eq((120 seconds -> human), "2 minutes")
assert_eq((60.1 seconds -> human), "1 minute + 0.100 seconds")
assert_eq((60.1 seconds -> human), "1 minute + 0.1 seconds")
assert_eq((1 minute -> human), "1 minute")
assert_eq((1.25 minute -> human), "1 minute + 15 seconds")
assert_eq((2.5 minute -> human), "2 minutes + 30 seconds")
Expand All @@ -23,16 +23,23 @@ assert_eq((1 week -> human), "7 days")
assert_eq((1.5 weeks -> human), "10 days + 12 hours")
assert_eq((2 weeks -> human), "14 days")

assert_eq((1 sidereal_day -> human), "23 hours + 56 minutes + 4.090500 seconds")
assert_eq((2 month -> human), "60 days + 20 hours + 58 minutes + 7.509 seconds (approx. 2 months)")
assert_eq((3 yr + 2 month -> human), "1156 days + 14 hours + 24 minutes + 22.664 seconds (approx. 3 years + 2 months)")
assert_eq((10 yr + 2 s -> human), "3652 days + 10 hours + 7 minutes + 32.518 seconds (approx. 10 years + 2 seconds)")

assert_eq((10000 days -> human), "10000 days")
assert_eq((50 million days -> human), "50_000_000 days")
assert_eq((1 sidereal_day -> human), "23 hours + 56 minutes + 4.091 seconds")

assert_eq((1e12 days -> human), "1_000_000_000_000 days")
assert_eq((1e15 days -> human), "1.0e+15 days")
assert_eq((10000 days -> human), "10000 days (approx. 27 years + 4 months + 16 days + 17 hours + 7 minutes + 28.583 seconds)")
assert_eq((50 million days -> human), "50_000_000 days (approx. 136_895 years + 5 months + 18 days + 11 hours + 25 minutes + 9.591 seconds)")

assert_eq((1e12 days -> human), "1_000_000_000_000 days (approx. 2_737_909_345 years + 12 days + 18 hours + 17 minutes + 24.141 seconds)")
assert_eq((1e15 days -> human), "1.0e+15 days (approx. 2_737_909_345_034 years + 11 months + 8 days + 22 hours + 40 minutes + 18.702 seconds)")

assert_eq((1 ms -> human), "0.001 seconds")
assert_eq((1 µs -> human), "0.000001 seconds")
assert_eq((1 ns -> human), "0.000000001 seconds")
assert_eq((1 ns -> human), "1.0e-9 seconds")
assert_eq((1234 ns -> human), "0.000001234 seconds")
assert_eq((1s + 1234 ns -> human), "1.000001234 seconds")
assert_eq((1s + 1234 ns -> human), "1 second")

assert_eq((-1 second -> human), "1 second ago")
assert_eq((-7.89 hour -> human), "7 hours + 53 minutes + 24 seconds ago")

0 comments on commit 78d94cc

Please sign in to comment.