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

27 lines
619 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 WeaponDryFireMessageTest extends Specification {
val string = hex"52 4C00"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case WeaponDryFireMessage(weapon_guid) =>
weapon_guid mustEqual PlanetSideGUID(76)
case _ =>
ko
}
}
"encode" in {
val msg = WeaponDryFireMessage(PlanetSideGUID(76))
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}