Skip to content

Commit 4071820

Browse files
Update test style
1 parent d6b4f58 commit 4071820

File tree

1 file changed

+43
-45
lines changed

1 file changed

+43
-45
lines changed

kotlinx-coroutines-core/common/test/DurationToMillisTest.kt

+43-45
Original file line numberDiff line numberDiff line change
@@ -11,61 +11,59 @@ import kotlin.time.Duration.Companion.seconds
1111

1212
class DurationToMillisTest {
1313

14-
@Test fun negative_duration_coerced_to_zero_millis() = assertEquals(
15-
expected = 0L,
16-
actual = (-1).seconds.toDelayMillis(),
17-
)
14+
@Test
15+
fun testNegativeDurationCoercedToZeroMillis() {
16+
assertEquals(0L, (-1).seconds.toDelayMillis())
17+
}
1818

19-
@Test fun zero_duration_coerced_to_zero_millis() = assertEquals(
20-
expected = 0L,
21-
actual = 0.seconds.toDelayMillis(),
22-
)
19+
@Test
20+
fun testZeroDurationCoercedToZeroMillis() {
21+
assertEquals(0L, 0.seconds.toDelayMillis())
22+
}
2323

24-
@Test fun one_nanosecond_coerced_to_one_millisecond() = assertEquals(
25-
expected = 1L,
26-
actual = 1.nanoseconds.toDelayMillis(),
27-
)
24+
@Test
25+
fun testOneNanosecondCoercedToOneMillisecond() {
26+
assertEquals(1L, 1.nanoseconds.toDelayMillis())
27+
}
2828

29-
@Test fun one_second_coerced_to_1000_milliseconds() = assertEquals(
30-
expected = 1_000L,
31-
actual = 1.seconds.toDelayMillis(),
32-
)
29+
@Test
30+
fun testOneSecondCoercedTo1000Milliseconds() {
31+
assertEquals(1_000L, 1.seconds.toDelayMillis())
32+
}
3333

34-
@Test fun mixed_component_duration_rounded_up_to_next_millisecond() = assertEquals(
35-
expected = 999L,
36-
actual = (998.milliseconds + 75909.nanoseconds).toDelayMillis(),
37-
)
34+
@Test
35+
fun testMixedComponentDurationRoundedUpToNextMillisecond() {
36+
assertEquals(999L, (998.milliseconds + 75909.nanoseconds).toDelayMillis())
37+
}
3838

39-
@Test fun one_extra_nanosecond_rounded_up_to_next_millisecond() = assertEquals(
40-
expected = 999L,
41-
actual = (998.milliseconds + 1.nanoseconds).toDelayMillis(),
42-
)
39+
@Test
40+
fun testOneExtraNanosecondRoundedUpToNextMillisecond() {
41+
assertEquals(999L, (998.milliseconds + 1.nanoseconds).toDelayMillis())
42+
}
4343

44-
@Test fun infinite_duration_coerced_to_Long_MAX_VALUE() = assertEquals(
45-
expected = Long.MAX_VALUE,
46-
actual = Duration.INFINITE.toDelayMillis(),
47-
)
44+
@Test
45+
fun testInfiniteDurationCoercedToLongMaxValue() {
46+
assertEquals(Long.MAX_VALUE, Duration.INFINITE.toDelayMillis())
47+
}
4848

49-
@Test fun negative_infinite_duration_coerced_to_zero() = assertEquals(
50-
expected = 0L,
51-
actual = (-Duration.INFINITE).toDelayMillis(),
52-
)
49+
@Test
50+
fun testNegativeInfiniteDurationCoercedToZero() {
51+
assertEquals(0L, (-Duration.INFINITE).toDelayMillis())
52+
}
5353

54-
@Test fun nanosecond_off_by_one_infinity_does_not_overflow() = assertEquals(
55-
expected = Long.MAX_VALUE / 1_000_000,
56-
actual = (Long.MAX_VALUE - 1L).nanoseconds.toDelayMillis(),
57-
)
54+
@Test
55+
fun testNanosecondOffByOneInfinityDoesNotOverflow() {
56+
assertEquals(Long.MAX_VALUE / 1_000_000, (Long.MAX_VALUE - 1L).nanoseconds.toDelayMillis())
57+
}
5858

59-
@Test fun millisecond_off_by_one_infinity_does_not_increment() = assertEquals(
60-
expected = (Long.MAX_VALUE / 2) - 1,
61-
actual = ((Long.MAX_VALUE / 2) - 1).milliseconds.toDelayMillis(),
62-
)
59+
@Test
60+
fun testMillisecondOffByOneInfinityDoesNotIncrement() {
61+
assertEquals((Long.MAX_VALUE / 2) - 1, ((Long.MAX_VALUE / 2) - 1).milliseconds.toDelayMillis())
62+
}
6363

64-
@Test fun out_of_bounds_nanoseconds_but_finite_dows_not_increment() {
64+
@Test
65+
fun testOutOfBoundsNanosecondsButFiniteDoesNotIncrement() {
6566
val milliseconds = Long.MAX_VALUE / 10
66-
assertEquals(
67-
expected = milliseconds,
68-
actual = milliseconds.milliseconds.toDelayMillis(),
69-
)
67+
assertEquals(milliseconds, milliseconds.milliseconds.toDelayMillis())
7068
}
7169
}

0 commit comments

Comments
 (0)