Small durations are formatted with sub-second units KT-42851

This commit is contained in:
Ilya Gorbunov
2021-06-29 04:40:18 +03:00
committed by Space
parent 150ce812f1
commit ae3d9cc3cd
3 changed files with 39 additions and 45 deletions
+16 -16
View File
@@ -568,26 +568,26 @@ class DurationTest {
test(Duration.seconds(1.3), "1.300s")
test(Duration.seconds(1), "1s")
test(Duration.seconds(0.5), "0.500s")
test(Duration.milliseconds(40.2), "0.040200s")
test(Duration.milliseconds(4.225), "0.004225s")
test(Duration.milliseconds(4.245), "0.004245s")
test(Duration.milliseconds(1), "0.001s")
test(Duration.seconds(0.5), "500ms")
test(Duration.milliseconds(40.2), "40.200ms")
test(Duration.milliseconds(4.225), "4.225ms")
test(Duration.milliseconds(4.24501), "4.245010ms")
test(Duration.milliseconds(1), "1ms")
test(Duration.milliseconds(0.75), "0.000750s")
test(Duration.microseconds(75.35), "0.000075350s")
test(Duration.microseconds(7.25), "0.000007250s")
test(Duration.microseconds(1.035), "0.000001035s")
test(Duration.microseconds(1.005), "0.000001005s")
test(Duration.milliseconds(0.75), "750us")
test(Duration.microseconds(75.35), "75.350us")
test(Duration.microseconds(7.25), "7.250us")
test(Duration.microseconds(1.035), "1.035us")
test(Duration.microseconds(1.005), "1.005us")
test(Duration.nanoseconds(950.5), "0.000000951s")
test(Duration.nanoseconds(85.23), "0.000000085s")
test(Duration.nanoseconds(8.235), "0.000000008s")
test(Duration.nanoseconds(1.3), "0.000000001s")
test(Duration.nanoseconds(950.5), "951ns")
test(Duration.nanoseconds(85.23), "85ns")
test(Duration.nanoseconds(8.235), "8ns")
test(Duration.nanoseconds(1.3), "1ns")
test(Duration.nanoseconds(0.75), "1ns")
test(Duration.nanoseconds(0.7512), "1ns")
// equal to zero
// test(Duration.nanoseconds(0.75), "0.75ns")
// test(Duration.nanoseconds(0.7512), "0.7512ns")
// test(Duration.nanoseconds(0.023), "0.023ns")
// test(Duration.nanoseconds(0.0034), "0.0034ns")
// test(Duration.nanoseconds(0.0000035), "0.0000035ns")