mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-03 04:00:20 +00:00
29 lines
682 B
Scala
29 lines
682 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 GenericObjectActionMessageTest extends Specification {
|
||
|
|
val string = hex"56 B501 24"
|
||
|
|
|
||
|
|
"decode" in {
|
||
|
|
PacketCoding.DecodePacket(string).require match {
|
||
|
|
case GenericObjectActionMessage(object_guid, action) =>
|
||
|
|
object_guid mustEqual PlanetSideGUID(437)
|
||
|
|
action mustEqual 36
|
||
|
|
case _ =>
|
||
|
|
ko
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
"encode" in {
|
||
|
|
val msg = GenericObjectActionMessage(PlanetSideGUID(437), 36)
|
||
|
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||
|
|
|
||
|
|
pkt mustEqual string
|
||
|
|
}
|
||
|
|
}
|