mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-02-13 03:33:40 +00:00
initial debug draw packet; data for the tests are entirely fabricated as we have no instances of this packet in the wild (#1170)
This commit is contained in:
parent
5d42f71901
commit
f2c486d6f6
3 changed files with 69 additions and 1 deletions
36
src/test/scala/game/DebugDrawMessageTest.scala
Normal file
36
src/test/scala/game/DebugDrawMessageTest.scala
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright (c) 2024 PSForever
|
||||
package game
|
||||
|
||||
import net.psforever.packet.PacketCoding
|
||||
import net.psforever.packet.game.DebugDrawMessage
|
||||
import net.psforever.types.Vector3
|
||||
import org.specs2.mutable.Specification
|
||||
import scodec.bits._
|
||||
|
||||
class DebugDrawMessageTest extends Specification {
|
||||
val string = hex"9c2040000000600000008000001c0010000186000800c8000f04008807d00016080578"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.decodePacket(string).require match {
|
||||
case DebugDrawMessage(u1, u2, u3, u4, u5) =>
|
||||
u1 mustEqual 1
|
||||
u2 mustEqual 2L
|
||||
u3 mustEqual 3L
|
||||
u4 mustEqual 4L
|
||||
u5 mustEqual List(
|
||||
Vector3(5,6,7),
|
||||
Vector3(50,60,70),
|
||||
Vector3(500,600,700)
|
||||
)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = DebugDrawMessage(1, 2L, 3L, 4L, List(Vector3(5,6,7), Vector3(50,60,70), Vector3(500,600,700)))
|
||||
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue