mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-02-28 19:13:40 +00:00
28 lines
559 B
Scala
28 lines
559 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 KeepAliveMessageTest extends Specification {
|
|
val string = hex"BA 0000"
|
|
|
|
"decode" in {
|
|
PacketCoding.DecodePacket(string).require match {
|
|
case KeepAliveMessage(code) =>
|
|
code mustEqual 0
|
|
case _ =>
|
|
ko
|
|
}
|
|
}
|
|
|
|
"encode" in {
|
|
val msg = KeepAliveMessage()
|
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
|
|
|
pkt mustEqual string
|
|
}
|
|
}
|
|
|