clarified fields and purpose; updated comments; working tests

This commit is contained in:
FateJH 2017-05-17 20:45:06 -04:00
parent fbe671e577
commit 92c126759a
2 changed files with 55 additions and 8 deletions

View file

@ -0,0 +1,31 @@
// Copyright (c) 2017 PSForever
package game
import org.specs2.mutable._
import net.psforever.packet._
import net.psforever.packet.game._
import scodec.bits._
class InventoryStateMessageTest extends Specification {
val string = hex"38 5C0B 00 3C02 B20000000 0"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case InventoryStateMessage(object_guid, unk, inv_guid, value) =>
object_guid mustEqual PlanetSideGUID(2908)
unk mustEqual 0
inv_guid mustEqual PlanetSideGUID(2800)
value mustEqual 200
case _ =>
ko
}
}
"encode" in {
val msg = InventoryStateMessage(PlanetSideGUID(2908), 0, PlanetSideGUID(2800), 200)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}