How long do you think this test takes to run? @Test fun `sleep sort should sort a list correctly` () = runTest { val unsorted = ( 1 .. 100_000 ). map { Random . nextInt ( 0 , Int . MAX_VALUE ) } val sorted = unsorted . sleepSort () assertEquals ( unsorted . sorted (), sorted ) } Enter fullscreen mode Exit fullscreen mode It sorts 100,000 random integers (up to Int.MAX_VALUE ) using Sleep Sort — an algorithm where each element waits in its own coroutine for a number of seconds equal to its value, then emits itself. A single element of Int.MAX_VALUE would take about 68 years to sleep through. The test passes in about a second. Not a trick — kotlinx-coroutines-test is doing something genuinely clever, and it's worth knowing about whether or not you ever sort anything by sleeping. Let me show you. What is Sleep Sort? Sleep Sort is the kind of algorithm you find on a wiki at 1am and immediately want to implement.…