You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
823 B
26 lines
823 B
package net.aiterp.git.ykonsole2.infrastructure.iconsole
|
|
|
|
import org.junit.jupiter.api.Assertions.*
|
|
import org.junit.jupiter.api.Test
|
|
|
|
internal class RequestTest {
|
|
@Test
|
|
fun `ACK cmd gets correct checksum`() {
|
|
val expected = listOf(0xf0, 0xa0, 0x01, 0x01, 0x92).map { it.toByte() }
|
|
val actual = AckRequest.toBytes().toList()
|
|
|
|
assertEquals(expected, actual)
|
|
}
|
|
|
|
@Test
|
|
fun `workout control state`() {
|
|
val expectedOne = listOf(0xf0, 0xa5, 0x01, 0x01, 0x02, 0x99).map { it.toByte() }
|
|
val expectedTwo = listOf(0xf0, 0xa5, 0x01, 0x01, 0x03, 0x9A).map { it.toByte() }
|
|
|
|
val actualOne = SetWorkoutControlStateRequest(1).toBytes().toList()
|
|
val actualTwo = SetWorkoutControlStateRequest(2).toBytes().toList()
|
|
|
|
assertEquals(expectedOne, actualOne)
|
|
assertEquals(expectedTwo, actualTwo)
|
|
}
|
|
}
|