mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-13 09:00:32 +00:00
Split Up GamePacketTest (#102)
* split up GamePacketTest into separate testing files * PR wants this file?
This commit is contained in:
parent
b00748727e
commit
6001446cd5
68 changed files with 4061 additions and 3597 deletions
48
common/src/test/scala/game/ObjectAttachMessageTest.scala
Normal file
48
common/src/test/scala/game/ObjectAttachMessageTest.scala
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
// 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 ObjectAttachMessageTest extends Specification {
|
||||
val stringToInventory = hex"2A 9F05 D405 86"
|
||||
val stringToCursor = hex"2A 9F05 D405 00FA"
|
||||
|
||||
"decode (inventory 1,1)" in {
|
||||
PacketCoding.DecodePacket(stringToInventory).require match {
|
||||
case ObjectAttachMessage(player_guid, item_guid, index) =>
|
||||
player_guid mustEqual PlanetSideGUID(1439)
|
||||
item_guid mustEqual PlanetSideGUID(1492)
|
||||
index mustEqual 6
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"decode (cursor)" in {
|
||||
PacketCoding.DecodePacket(stringToCursor).require match {
|
||||
case ObjectAttachMessage(player_guid, item_guid, index) =>
|
||||
player_guid mustEqual PlanetSideGUID(1439)
|
||||
item_guid mustEqual PlanetSideGUID(1492)
|
||||
index mustEqual 250
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode (inventory 1,1)" in {
|
||||
val msg = ObjectAttachMessage(PlanetSideGUID(1439), PlanetSideGUID(1492), 6)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual stringToInventory
|
||||
}
|
||||
|
||||
"encode (cursor)" in {
|
||||
val msg = ObjectAttachMessage(PlanetSideGUID(1439), PlanetSideGUID(1492), 250)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual stringToCursor
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue