PSF-BotServer/common/src/test/scala/game/PingMsgTest.scala
2017-03-06 19:30:45 -05:00

26 lines
550 B
Scala

// Copyright (c) 2017 PSForever
package game
import org.specs2.mutable._
import net.psforever.packet._
import net.psforever.packet.game._
import scodec.bits._
class PingMsgTest extends Specification {
val packet = hex"1a 00000000 b0360000"
"decode" in {
PacketCoding.DecodePacket(packet).require match {
case PingMsg(unk1, unk2) =>
unk1 === 0
unk2 === 14000
case _ =>
ko
}
}
"encode" in {
val msg = PingMsg(0, 14000)
PacketCoding.EncodePacket(msg).require.toByteVector === packet
}
}