Here's my delegate implementation: ``` class ByteD...
# announcements
r
Here's my delegate implementation:
Copy code
class ByteDelegateFailing(
    private val position: Int,
    private val uIntValue: KProperty0<UInt>
) {
    operator fun getValue(any: Any?, property: KProperty<*>): UByte {
        val uInt = uIntValue.get() shr (position * 8) and 0xffu
        return uInt.toUByte()
    }
}
and a test
Copy code
class JvmByteDelegateTest {

    val uInt = 0xA1B2C3u
    val b2 by ByteDelegateFailing(0, this::uInt)

    @Test
    fun `Failing example`() {
        val actual = b2
        assertEquals(0xC3u, actual)
    }
}