mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-20 02:54:46 +00:00
tests and corrections
This commit is contained in:
parent
74863858f7
commit
72b7c35b3f
|
|
@ -14,4 +14,4 @@ class SpawnTubeControl(tube : SpawnTube) extends Actor with FactionAffinityBehav
|
|||
def receive : Receive = checkBehavior.orElse { case _ =>; }
|
||||
|
||||
override def toString : String = tube.Definition.Name
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@ object SpawnTubeDefinition {
|
|||
obj.Actor = context.actorOf(Props(classOf[SpawnTubeControl], obj), s"${obj.Definition.Name}_${obj.GUID.guid}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
31
common/src/test/scala/game/SpawnRequestMessageTest.scala
Normal file
31
common/src/test/scala/game/SpawnRequestMessageTest.scala
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import scodec.bits._
|
||||
|
||||
class SpawnRequestMessageTest extends Specification {
|
||||
val string = hex"4a000007000000000000000200"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case SpawnRequestMessage(unk1,unk2,unk3,unk4,unk5) =>
|
||||
unk1 mustEqual 0
|
||||
unk2 mustEqual 7
|
||||
unk3 mustEqual 0
|
||||
unk4 mustEqual 0
|
||||
unk5 mustEqual 2
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = SpawnRequestMessage(0, 7, 0, 0, 2)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import net.psforever.objects.equipment.CItem.{DeployedItem, Unit}
|
|||
import net.psforever.objects.equipment._
|
||||
import net.psforever.objects.inventory.InventoryTile
|
||||
import net.psforever.objects.serverobject.terminals.Terminal
|
||||
import net.psforever.objects.serverobject.tube.SpawnTube
|
||||
import net.psforever.packet.game.PlanetSideGUID
|
||||
import net.psforever.packet.game.objectcreate._
|
||||
import net.psforever.types.{CharacterGender, PlanetSideEmpire, Vector3}
|
||||
|
|
@ -296,6 +297,26 @@ class ConverterTest extends Specification {
|
|||
}
|
||||
}
|
||||
|
||||
"Spawn Tube" should {
|
||||
"convert to packet" in {
|
||||
val obj = SpawnTube(GlobalDefinitions.ams_respawn_tube)
|
||||
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Failure(err) =>
|
||||
err.isInstanceOf[NoSuchMethodException] mustEqual true
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual CommonTerminalData(PlanetSideEmpire.NEUTRAL)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"Vehicle" should {
|
||||
"convert to packet (1)" in {
|
||||
val hellfire_ammo = AmmoBoxDefinition(Ammo.hellfire_ammo.id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue