Add field synchronizer > 128 fields test
This commit is contained in:
parent
5b596dc2cb
commit
1dfdc44acd
@ -4,6 +4,7 @@ import org.junit.jupiter.api.Assertions.assertEquals
|
|||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import ru.dbotthepony.mc.otm.network.FieldSynchronizer
|
import ru.dbotthepony.mc.otm.network.FieldSynchronizer
|
||||||
|
import ru.dbotthepony.mc.otm.network.IMutableField
|
||||||
import java.io.ByteArrayInputStream
|
import java.io.ByteArrayInputStream
|
||||||
|
|
||||||
object FieldSynchronizerTests {
|
object FieldSynchronizerTests {
|
||||||
@ -105,4 +106,29 @@ object FieldSynchronizerTests {
|
|||||||
assertEquals(aFields[i].value, field.value)
|
assertEquals(aFields[i].value, field.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Field Synchronizer Lotta fields")
|
||||||
|
fun lottaFields() {
|
||||||
|
val a = FieldSynchronizer()
|
||||||
|
val b = FieldSynchronizer()
|
||||||
|
|
||||||
|
val fieldsa = ArrayList<IMutableField<Int>>()
|
||||||
|
val fieldsb = ArrayList<IMutableField<Int>>()
|
||||||
|
|
||||||
|
for (i in 0 .. 900) {
|
||||||
|
fieldsa.add(a.int())
|
||||||
|
fieldsb.add(b.int())
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i in 0 .. 900) {
|
||||||
|
fieldsa[i].value = i
|
||||||
|
}
|
||||||
|
|
||||||
|
b.applyNetworkPayload(a.collectNetworkPayload()!!.let { ByteArrayInputStream(it.array, 0, it.length) })
|
||||||
|
|
||||||
|
for (i in 0 .. 900) {
|
||||||
|
assertEquals(fieldsa[i].value, fieldsb[i].value)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user