mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-28 07:15:21 +00:00
clarified field names, comments, and added tests
This commit is contained in:
parent
26f674b869
commit
71334868f2
4 changed files with 103 additions and 41 deletions
32
common/src/test/scala/game/ObjectDeployedMessageTest.scala
Normal file
32
common/src/test/scala/game/ObjectDeployedMessageTest.scala
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import net.psforever.types.Vector3
|
||||
import scodec.bits._
|
||||
|
||||
class ObjectDeployedMessageTest extends Specification {
|
||||
val string_boomer = hex"86 000086626F6F6D6572040000000100000019000000"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string_boomer).require match {
|
||||
case ObjectDeployedMessage(guid : PlanetSideGUID, desc : String, unk : Long, count : Long, max : Long) =>
|
||||
guid mustEqual PlanetSideGUID(0)
|
||||
desc mustEqual "boomer"
|
||||
unk mustEqual 4
|
||||
count mustEqual 1
|
||||
max mustEqual 25
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = ObjectDeployedMessage("boomer", 4, 1, 25)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_boomer
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue