in theory, the tests are fixed; that may change from execution to execution, as is usual

This commit is contained in:
Fate-JH 2023-05-05 10:04:46 -04:00
parent 0da03b0f0f
commit 53178ba1d9
3 changed files with 37 additions and 40 deletions

View file

@ -32,7 +32,7 @@ import org.specs2.mutable.Specification
import scala.concurrent.duration._
import net.psforever.objects.avatar.Avatar
import net.psforever.objects.serverobject.terminals.implant.{ImplantTerminalMech, ImplantTerminalMechControl}
import net.psforever.objects.sourcing.{PlayerSource, SourceEntry, VehicleSource}
import net.psforever.objects.sourcing.{PlayerSource, SourceEntry}
import net.psforever.objects.vital.interaction.DamageInteraction
import net.psforever.objects.vital.base.DamageResolution
import net.psforever.objects.vital.projectile.ProjectileReason
@ -327,21 +327,17 @@ class DamageableEntityDamageTest extends ActorTest {
gen.Actor ! Vitality.Damage(applyDamageTo)
val msg1 = avatarProbe.receiveOne(500 milliseconds)
val msg2 = activityProbe.receiveOne(500 milliseconds)
assert(
msg1 match {
case AvatarServiceMessage("test", AvatarAction.PlanetsideAttributeToAll(PlanetSideGUID(2), 0, _)) => true
case _ => false
}
)
assert(
msg2 match {
case activity: Zone.HotSpot.Activity =>
activity.attacker == PlayerSource(player1) &&
activity.defender == SourceEntry(gen) &&
activity.location == Vector3(1, 0, 0)
case _ => false
}
)
msg1 match {
case AvatarServiceMessage("test", AvatarAction.PlanetsideAttributeToAll(ValidPlanetSideGUID(2), 0, 3600)) => ()
case _ => assert(false, "DamageableEntity:handle taking damage - player not messaged")
}
msg2 match {
case activity: Zone.HotSpot.Activity
if activity.attacker == PlayerSource(player1) &&
activity.defender == SourceEntry(gen) &&
activity.location == Vector3(1, 0, 0) => ()
case _ => assert(false, "DamageableEntity:handle taking damage - activity not messaged")
}
}
}
}

View file

@ -320,15 +320,12 @@ class DeployableBehaviorDeconstructOwnedTest extends FreedContextActorTest {
jmine.Actor ! Deployable.Deconstruct()
val eventsMsgs = eventsProbe.receiveN(3, 10.seconds)
eventsMsgs.head match {
case LocalServiceMessage("test", LocalAction.EliminateDeployable(`jmine`, PlanetSideGUID(1), Vector3(1,2,3), 2)) => ;
case LocalServiceMessage("test",LocalAction.EliminateDeployable(mine, ValidPlanetSideGUID(1), Vector3(1.0,2.0,3.0),2))
if mine eq jmine => ;
case _ => assert(false, "owned deconstruct test - not eliminating deployable")
}
eventsMsgs(1) match {
case LocalServiceMessage("TestCharacter1", LocalAction.DeployableUIFor(DeployedItem.jammer_mine)) => ;
case _ => assert(false, "")
}
eventsMsgs(2) match {
case LocalServiceMessage(
case LocalServiceMessage(
"TR",
LocalAction.DeployableMapIcon(
PlanetSideGUID(0),
@ -338,6 +335,10 @@ class DeployableBehaviorDeconstructOwnedTest extends FreedContextActorTest {
) => ;
case _ => assert(false, "owned deconstruct test - not removing icon")
}
eventsMsgs(2) match {
case LocalServiceMessage("TestCharacter1", LocalAction.DeployableUIFor(DeployedItem.jammer_mine)) => ;
case _ => assert(false, "")
}
assert(deployableList.isEmpty, "owned deconstruct test - deployable still in list")
assert(!avatar.deployables.Contains(jmine), "owned deconstruct test - avatar still owns deployable")

View file

@ -25,6 +25,7 @@ import net.psforever.objects.vital.interaction.DamageInteraction
import net.psforever.objects.vital.projectile.ProjectileReason
import akka.actor.typed.scaladsl.adapter._
import net.psforever.objects.sourcing.{PlayerSource, SourceEntry}
import net.psforever.services.local.LocalAction.DeployableMapIcon
import scala.collection.mutable
import scala.concurrent.duration._
@ -447,9 +448,9 @@ class ExplosiveDeployableJammerExplodeTest extends ActorTest {
assert(!h_mine.Destroyed)
h_mine.Actor ! Vitality.Damage(applyDamageToH)
val eventMsgs = eventsProbe.receiveN(5, 200 milliseconds)
val eventMsgs = eventsProbe.receiveN(4, 200 milliseconds)
val p1Msgs = player1Probe.receiveN(1, 200 milliseconds)
player2Probe.expectNoMessage(200 milliseconds)
val p2Msgs = player2Probe.receiveN(1, 200 milliseconds)
eventMsgs.head match {
case Zone.HotSpot.Conflict(target, attacker, _)
if (target.Definition eq h_mine.Definition) && (attacker eq pSource) => ;
@ -461,10 +462,6 @@ class ExplosiveDeployableJammerExplodeTest extends ActorTest {
case _ => assert(false, "")
}
eventMsgs(2) match {
case LocalServiceMessage("TestCharacter2", LocalAction.DeployableUIFor(DeployedItem.he_mine)) => ;
case _ => assert(false, "")
}
eventMsgs(3) match {
case LocalServiceMessage(
"NC",
LocalAction.DeployableMapIcon(
@ -475,7 +472,7 @@ class ExplosiveDeployableJammerExplodeTest extends ActorTest {
) => ;
case _ => assert(false, "")
}
eventMsgs(4) match {
eventMsgs(3) match {
case AvatarServiceMessage(
"test",
AvatarAction.Destroy(PlanetSideGUID(2), PlanetSideGUID(3), Service.defaultPlayerGUID, Vector3.Zero)
@ -486,7 +483,10 @@ class ExplosiveDeployableJammerExplodeTest extends ActorTest {
case Vitality.Damage(_) => ;
case _ => assert(false, "")
}
assert(!avatar2.deployables.Contains(h_mine))
p2Msgs.head match {
case Player.LoseDeployable(_) => ;
case _ => assert(false, "")
}
assert(h_mine.Destroyed)
}
}
@ -558,14 +558,10 @@ class ExplosiveDeployableDestructionTest extends ActorTest {
assert(!h_mine.Destroyed)
h_mine.Actor ! Vitality.Damage(applyDamageTo)
val eventMsgs = eventsProbe.receiveN(4, 200 milliseconds)
val eventMsgs = eventsProbe.receiveN(3, 200 milliseconds)
player1Probe.expectNoMessage(200 milliseconds)
player2Probe.expectNoMessage(200 milliseconds)
val p2Msgs = player2Probe.receiveN(1, 200 milliseconds)
eventMsgs.head match {
case LocalServiceMessage("TestCharacter2", LocalAction.DeployableUIFor(DeployedItem.he_mine)) => ;
case _ => assert(false, "")
}
eventMsgs(1) match {
case LocalServiceMessage(
"NC",
LocalAction.DeployableMapIcon(
@ -576,17 +572,21 @@ class ExplosiveDeployableDestructionTest extends ActorTest {
) => ;
case _ => assert(false, "")
}
eventMsgs(2) match {
eventMsgs(1) match {
case AvatarServiceMessage(
"test",
AvatarAction.Destroy(PlanetSideGUID(2), PlanetSideGUID(3), Service.defaultPlayerGUID, Vector3.Zero)
"test",
AvatarAction.Destroy(PlanetSideGUID(2), PlanetSideGUID(3), Service.defaultPlayerGUID, Vector3.Zero)
) => ;
case _ => assert(false, "")
}
eventMsgs(3) match {
eventMsgs(2) match {
case LocalServiceMessage("test", LocalAction.TriggerEffect(_, "detonate_damaged_mine", PlanetSideGUID(2))) => ;
case _ => assert(false, "")
}
p2Msgs.head match {
case Player.LoseDeployable(_) => ;
case _ => assert(false, "")
}
assert(h_mine.Health <= h_mine.Definition.DamageDestroysAt)
assert(h_mine.Destroyed)
}