2017-04-22 19:00:25 -04:00
|
|
|
// Copyright (c) 2017 PSForever
|
|
|
|
|
package game
|
|
|
|
|
|
|
|
|
|
import org.specs2.mutable._
|
|
|
|
|
import net.psforever.packet._
|
|
|
|
|
import net.psforever.packet.game._
|
|
|
|
|
import scodec.bits._
|
|
|
|
|
|
|
|
|
|
class ObjectDeployedMessageTest extends Specification {
|
|
|
|
|
val string_boomer = hex"86 000086626F6F6D6572040000000100000019000000"
|
|
|
|
|
|
|
|
|
|
"decode" in {
|
|
|
|
|
PacketCoding.DecodePacket(string_boomer).require match {
|
2018-09-23 08:00:58 -04:00
|
|
|
case ObjectDeployedMessage(unk : Int, desc : String, act : DeployOutcome.Value, count : Long, max : Long) =>
|
2017-04-23 02:09:24 -04:00
|
|
|
unk mustEqual 0
|
2017-04-22 19:00:25 -04:00
|
|
|
desc mustEqual "boomer"
|
2018-09-23 08:00:58 -04:00
|
|
|
act mustEqual DeployOutcome.Success
|
2017-04-22 19:00:25 -04:00
|
|
|
count mustEqual 1
|
|
|
|
|
max mustEqual 25
|
|
|
|
|
case _ =>
|
|
|
|
|
ko
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"encode" in {
|
2018-09-23 08:00:58 -04:00
|
|
|
val msg = ObjectDeployedMessage("boomer", DeployOutcome.Success, 1, 25)
|
2017-04-22 19:00:25 -04:00
|
|
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
|
|
|
|
|
|
|
|
|
pkt mustEqual string_boomer
|
|
|
|
|
}
|
|
|
|
|
}
|