PSF-BotServer/common/src/test/scala/game/PlanetsideAttributeMessageTest.scala
SouNourS 6798ec546c Packet: Planetsideattributemessage (#119)
* initial PlanetsideAttributeMessage packet work

* Update with comments from a little search.
2017-03-10 21:50:38 -05:00

30 lines
787 B
Scala

// Copyright (c) 2017 PSForever
package game
import org.specs2.mutable.Specification
import net.psforever.packet.PacketCoding
import net.psforever.packet.game._
import scodec.bits._
class PlanetsideAttributeMessageTest extends Specification {
val string = hex"2c d9040458000000"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case PlanetsideAttributeMessage(player_guid, attribute_type, attribute_value) =>
player_guid mustEqual PlanetSideGUID(1241)
attribute_type mustEqual 4
attribute_value mustEqual 88
case _ =>
ko
}
}
"encode" in {
val msg = PlanetsideAttributeMessage(PlanetSideGUID(1241), 4, 88)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}