mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-03-03 04:20:23 +00:00
29 lines
727 B
Scala
29 lines
727 B
Scala
// Copyright (c) 2017 PSForever
|
|
package game
|
|
|
|
import org.specs2.mutable._
|
|
import net.psforever.packet._
|
|
import net.psforever.packet.game._
|
|
import net.psforever.types.PlanetSideEmpire
|
|
import scodec.bits._
|
|
|
|
class SetEmpireMessageTest extends Specification {
|
|
val string = hex"24 02 00 80"
|
|
|
|
"decode" in {
|
|
PacketCoding.DecodePacket(string).require match {
|
|
case SetEmpireMessage(object_guid, empire) =>
|
|
object_guid mustEqual PlanetSideGUID(2)
|
|
empire mustEqual PlanetSideEmpire.VS
|
|
case _ =>
|
|
ko
|
|
}
|
|
}
|
|
|
|
"encode" in {
|
|
val msg = SetEmpireMessage(PlanetSideGUID(2), PlanetSideEmpire.VS)
|
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
|
|
|
pkt mustEqual string
|
|
}
|
|
}
|