mjthornton
03/25/2020, 4:18 AMianbrandt
03/26/2020, 3:31 AMDynamicTest
from Kotlin for parameterized unit testing. It's really only enough content for a quick lightning talk, though, so we'd need something more or it'll be a pretty short meeting.mjthornton
03/26/2020, 4:09 PMAugust Gruneisen
03/26/2020, 4:16 PMianbrandt
03/26/2020, 10:34 PMLou Morda
05/05/2020, 4:44 PMianbrandt
05/05/2020, 5:23 PMpreviousWallTimeNanos
property here:
private const val UNINITIALIZED = -1L
class GameClock {
private var previousWallTimeNanos = UNINITIALIZED
var deltaTimeNanos: Long = 0L
private set
fun update(wallTimeNanos: Long) {
if (previousWallTimeNanos == UNINITIALIZED) {
previousWallTimeNanos = wallTimeNanos
return
}
deltaTimeNanos = wallTimeNanos - previousWallTimeNanos
previousWallTimeNanos = wallTimeNanos
}
}
Unfortunately...
'lateinit' modifier is not allowed on properties of primitive types
So I ended up going with the plain old "if uninitialized" logic. The use case is single threaded, so I didn't need to worry about synchronization.
I thought about creating a "LateInit" property delegate, but I'd only need it for the one instance in this application, so it didn't seem worth the added complexity.
I'm a little surprised there isn't already such a property delegate in the #stdlib. Maybe I'll write one up and submit a pull request.