mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-22 08:03:34 +00:00
adding tests for utilities and fixing tests for AMS; adding information to PAMessage; scaling back modifications to WSA
This commit is contained in:
parent
e93c510d22
commit
74863858f7
4 changed files with 135 additions and 126 deletions
|
|
@ -1,7 +1,6 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package objects
|
||||
|
||||
import net.psforever.objects.GlobalDefinitions.remote_electronics_kit
|
||||
import net.psforever.objects.definition.converter.{ACEConverter, CharacterSelectConverter, REKConverter}
|
||||
import net.psforever.objects._
|
||||
import net.psforever.objects.definition._
|
||||
|
|
@ -184,13 +183,13 @@ class ConverterTest extends Specification {
|
|||
"convert to packet (BR < 24)" in {
|
||||
obj.BEP = 0
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
case Success(_) =>
|
||||
ok
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
case Success(_) =>
|
||||
ok
|
||||
case _ =>
|
||||
ko
|
||||
|
|
@ -200,13 +199,13 @@ class ConverterTest extends Specification {
|
|||
"convert to packet (BR >= 24)" in {
|
||||
obj.BEP = 10000000
|
||||
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
case Success(_) =>
|
||||
ok
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
case Success(_) =>
|
||||
ok
|
||||
case _ =>
|
||||
ko
|
||||
|
|
@ -216,7 +215,7 @@ class ConverterTest extends Specification {
|
|||
"convert to simple packet (BR < 24)" in {
|
||||
obj.BEP = 0
|
||||
converter.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
case Success(_) =>
|
||||
ok
|
||||
case _ =>
|
||||
ko
|
||||
|
|
@ -228,7 +227,7 @@ class ConverterTest extends Specification {
|
|||
"convert to simple packet (BR >= 24)" in {
|
||||
obj.BEP = 10000000
|
||||
converter.DetailedConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
case Success(_) =>
|
||||
ok
|
||||
case _ =>
|
||||
ko
|
||||
|
|
@ -290,7 +289,7 @@ class ConverterTest extends Specification {
|
|||
|
||||
obj.Definition.Packet.ConstructorData(obj) match {
|
||||
case Success(pkt) =>
|
||||
pkt mustEqual CommonTerminalData(PlanetSideEmpire.NEUTRAL, 0)
|
||||
pkt mustEqual CommonTerminalData(PlanetSideEmpire.NEUTRAL)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -338,8 +337,10 @@ class ConverterTest extends Specification {
|
|||
val
|
||||
ams = Vehicle(GlobalDefinitions.ams)
|
||||
ams.GUID = PlanetSideGUID(413)
|
||||
ams.Utilities(3)().GUID = PlanetSideGUID(414)
|
||||
ams.Utilities(4)().GUID = PlanetSideGUID(415)
|
||||
ams.Utilities(1)().GUID = PlanetSideGUID(414)
|
||||
ams.Utilities(2)().GUID = PlanetSideGUID(415)
|
||||
ams.Utilities(3)().GUID = PlanetSideGUID(416)
|
||||
ams.Utilities(4)().GUID = PlanetSideGUID(417)
|
||||
|
||||
ams.Definition.Packet.ConstructorData(ams).isSuccess mustEqual true
|
||||
ok //TODO write more of this test
|
||||
|
|
|
|||
|
|
@ -27,6 +27,49 @@ class UtilityTest extends Specification {
|
|||
obj().asInstanceOf[Terminal].Definition.ObjectId mustEqual 614
|
||||
obj().asInstanceOf[Terminal].Actor == ActorRef.noSender
|
||||
}
|
||||
|
||||
"create a matrix_terminalc object" in {
|
||||
val obj = Utility(UtilityType.matrix_terminalc, UtilityTest.vehicle)
|
||||
obj.UtilType mustEqual UtilityType.matrix_terminalc
|
||||
obj().isInstanceOf[Terminal] mustEqual true
|
||||
obj().asInstanceOf[Terminal].Definition.ObjectId mustEqual 519
|
||||
obj().asInstanceOf[Terminal].Actor == ActorRef.noSender
|
||||
}
|
||||
|
||||
"create an ams_respawn_tube object" in {
|
||||
import net.psforever.objects.serverobject.tube.SpawnTube
|
||||
val obj = Utility(UtilityType.ams_respawn_tube, UtilityTest.vehicle)
|
||||
obj.UtilType mustEqual UtilityType.ams_respawn_tube
|
||||
obj().isInstanceOf[SpawnTube] mustEqual true
|
||||
obj().asInstanceOf[SpawnTube].Definition.ObjectId mustEqual 49
|
||||
obj().asInstanceOf[SpawnTube].Actor == ActorRef.noSender
|
||||
}
|
||||
|
||||
"be located with their owner (terminal)" in {
|
||||
val veh = Vehicle(GlobalDefinitions.quadstealth)
|
||||
val obj = Utility(UtilityType.order_terminala, veh)
|
||||
obj().Position mustEqual veh.Position
|
||||
obj().Orientation mustEqual veh.Orientation
|
||||
|
||||
import net.psforever.types.Vector3
|
||||
veh.Position = Vector3(1, 2, 3)
|
||||
veh.Orientation = Vector3(4, 5, 6)
|
||||
obj().Position mustEqual veh.Position
|
||||
obj().Orientation mustEqual veh.Orientation
|
||||
}
|
||||
|
||||
"be located with their owner (spawn tube)" in {
|
||||
val veh = Vehicle(GlobalDefinitions.quadstealth)
|
||||
val obj = Utility(UtilityType.ams_respawn_tube, veh)
|
||||
obj().Position mustEqual veh.Position
|
||||
obj().Orientation mustEqual veh.Orientation
|
||||
|
||||
import net.psforever.types.Vector3
|
||||
veh.Position = Vector3(1, 2, 3)
|
||||
veh.Orientation = Vector3(4, 5, 6)
|
||||
obj().Position mustEqual veh.Position
|
||||
obj().Orientation mustEqual veh.Orientation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -58,6 +101,34 @@ class Utility2Test extends ActorTest() {
|
|||
}
|
||||
}
|
||||
|
||||
class Utility3Test extends ActorTest() {
|
||||
"Utility" should {
|
||||
"wire a matrix_terminalc Actor" in {
|
||||
val obj = Utility(UtilityType.matrix_terminalc, UtilityTest.vehicle)
|
||||
obj().GUID = PlanetSideGUID(1)
|
||||
assert(obj().Actor == ActorRef.noSender)
|
||||
|
||||
system.actorOf(Props(classOf[UtilityTest.SetupControl], obj), "test") ! ""
|
||||
receiveOne(Duration.create(100, "ms")) //consume and discard
|
||||
assert(obj().Actor != ActorRef.noSender)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Utility4Test extends ActorTest() {
|
||||
"Utility" should {
|
||||
"wire an ams_respawn_tube Actor" in {
|
||||
val obj = Utility(UtilityType.ams_respawn_tube, UtilityTest.vehicle)
|
||||
obj().GUID = PlanetSideGUID(1)
|
||||
assert(obj().Actor == ActorRef.noSender)
|
||||
|
||||
system.actorOf(Props(classOf[UtilityTest.SetupControl], obj), "test") ! ""
|
||||
receiveOne(Duration.create(100, "ms")) //consume and discard
|
||||
assert(obj().Actor != ActorRef.noSender)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object UtilityTest {
|
||||
val vehicle = Vehicle(GlobalDefinitions.quadstealth)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue