Split Up GamePacketTest (#102)

* split up GamePacketTest into separate testing files

* PR wants this file?
This commit is contained in:
Fate-JH 2017-03-04 10:06:10 -05:00 committed by pschord
parent b00748727e
commit 6001446cd5
68 changed files with 4061 additions and 3597 deletions

View file

@ -0,0 +1,29 @@
// Copyright (c) 2016 PSForever.net to present
package game
import org.specs2.mutable._
import net.psforever.packet._
import net.psforever.packet.game._
import scodec.bits._
class ReloadMessageTest extends Specification {
val string = hex"0D 4C00 7B000000 FFFFFFFF"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case ReloadMessage(item_guid, ammo_clip, unk1) =>
item_guid mustEqual PlanetSideGUID(76)
ammo_clip mustEqual 123
unk1 mustEqual -1
case _ =>
ko
}
}
"encode" in {
val msg = ReloadMessage(PlanetSideGUID(76), 123, -1)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}