From 78d94ccee0c584fe56788ed360f5b7a96311f7d6 Mon Sep 17 00:00:00 2001 From: Valentin Le Tallec Date: Sat, 13 Jul 2024 19:02:20 +0200 Subject: [PATCH] Impact test with new format --- examples/datetime_human_tests.nbt | 45 ------------------------------- examples/tests/human.nbt | 25 ++++++++++------- 2 files changed, 16 insertions(+), 54 deletions(-) delete mode 100644 examples/datetime_human_tests.nbt diff --git a/examples/datetime_human_tests.nbt b/examples/datetime_human_tests.nbt deleted file mode 100644 index 535ffc91..00000000 --- a/examples/datetime_human_tests.nbt +++ /dev/null @@ -1,45 +0,0 @@ -assert((0 second -> human) == "0 seconds") -assert((1 second -> human) == "1 second") -assert((5 second -> human) == "5 seconds") -assert((1.5 second -> human) == "1.5 seconds") - -assert((60 seconds -> human) == "1 minute") -assert((73 seconds -> human) == "1 minute + 13 seconds") -assert((120 seconds -> human) == "2 minutes") -assert((60.1 seconds -> human) == "1 minute + 0.1 seconds") -assert((1 minute -> human) == "1 minute") -assert((1.25 minute -> human) == "1 minute + 15 seconds") -assert((2.5 minute -> human) == "2 minutes + 30 seconds") - -assert((1 hour -> human) == "1 hour") -assert((1.5 hour -> human) == "1 hour + 30 minutes") -assert((2 hour -> human) == "2 hours") -assert((1 hour + 1 sec -> human) == "1 hour + 1 second") - -assert((1 day -> human) == "1 day") -assert((1.37 day -> human) == "1 day + 8 hours + 52 minutes + 48 seconds") - -assert((1 week -> human) == "7 days") -assert((1.5 weeks -> human) == "10 days + 12 hours") -assert((2 weeks -> human) == "14 days") - -assert((2 month -> human) == "60 days + 20 hours + 58 minutes + 7.509 seconds (approx. 2 months)") -assert((3 yr + 2 month -> human) == "1156 days + 14 hours + 24 minutes + 22.664 seconds (approx. 3 years + 2 months)") -assert((10 yr + 2 s -> human) == "3652 days + 10 hours + 7 minutes + 32.518 seconds (approx. 10 years + 2 seconds)") - -assert((1 sidereal_day -> human) == "23 hours + 56 minutes + 4.091 seconds") - -assert((10000 days -> human) == "10000 days (approx. 27 years + 4 months + 16 days + 17 hours + 7 minutes + 28.583 seconds)") -assert((50 million days -> human) == "50_000_000 days (approx. 136_895 years + 5 months + 18 days + 11 hours + 25 minutes + 9.591 seconds)") - -assert((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((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((1 ms -> human) == "0.001 seconds") -assert((1 µs -> human) == "0.000001 seconds") -assert((1 ns -> human) == "1.0e-9 seconds") -assert((1234 ns -> human) == "0.000001234 seconds") -assert((1s + 1234 ns -> human) == "1 second") - -assert((-1 second -> human) == "1 second ago") -assert((-7.89 hour -> human) == "7 hours + 53 minutes + 24 seconds ago") diff --git a/examples/tests/human.nbt b/examples/tests/human.nbt index 4d51538d..7e02105d 100644 --- a/examples/tests/human.nbt +++ b/examples/tests/human.nbt @@ -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") @@ -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")