feat(connector): add VDMJ into Test

This commit is contained in:
Anthony Berg
2024-05-09 09:01:23 +01:00
parent d1b45a4d5a
commit 02d5ed8c35
2 changed files with 10 additions and 2 deletions

View File

@@ -38,7 +38,7 @@ class TestRun (
if (!running and (tested.size == 0)) {
running = true
screenModel.init()
screenModel.init(actions)
}
when (val s = state) {

View File

@@ -5,7 +5,9 @@ import cafe.adriel.voyager.core.model.StateScreenModel
import cafe.adriel.voyager.core.model.screenModelScope
import io.anthonyberg.connector.shared.TestTransaction
import io.anthonyberg.connector.shared.entity.Action
import io.anthonyberg.connector.shared.vdmj.VDMJTransaction
import io.anthonyberg.connector.shared.xpc.XPC
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@@ -14,11 +16,12 @@ class TestScreenModel (
private val interfaceState: InterfaceState
) : StateScreenModel<TestState>(TestState.Init) {
private val xpc = XPC()
private val logger = KotlinLogging.logger {}
/**
* Sets up necessary connections
*/
fun init() {
fun init(actions: List<Action>) {
screenModelScope.launch {
mutableState.value = TestState.Init
@@ -47,6 +50,11 @@ class TestScreenModel (
xpc.setPOSI(posi)
}
val vdm = VDMJTransaction(actions = actions, xpc = xpc)
val expected = vdm.expectedEndState()
logger.debug { expected }
delay(5000L)
// Starts the test in the database