Scala test timeout

I submitted Clock, the tests run successfully locally (including those marked with pending), but timeout on the server.

object  Clock:
    // https://docs.scala-lang.org/scala3/book/types-opaque-types.html
    opaque type Clock = (Int, Int)

    // Integer division truncated toward negative infinity
    private def floorDiv(x: Int, y: Int) =
        val q = x / y
        if (q * y == x || math.signum(x) == math.signum(y)) then q
        else q - 1

    def apply(hour: Int, minutes: Int): Clock =
        val hr = Math.floorMod(hour, 24)
        val min = Math.floorMod(minutes, 60)
        val h = floorDiv(minutes, 60)
        val x = Math.floorMod(hr + h, 24)

        (x, min)

    def apply(minutes: Int): Clock =
        apply(0, minutes)

    extension (x: Clock)
        def + (y: Clock): Clock = Clock(x._1 + y._1, x._2 + y._2)
        def - (y: Clock): Clock = Clock(x._1 - y._1, x._2 - y._2)

I think the test runner is just slow so you may need to retry a few times. The continuous integration example solution also times out repeatedly until it finally passes.

It is quite slow. If anyone has any good ideas on how to improve performance, a PR to GitHub - exercism/scala-test-runner is much appreciated.

I briefly studied the test runner code. In order to speed it up, we first need to understand which parts are slow. How do I look into the build logs, and is there a way to turn up the verbosity for debugging?

You’d do that by running the test runner locally. You can make any desired modification there.