mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-22 12:25:21 +00:00
added tests
This commit is contained in:
parent
4ac93de065
commit
040bea8b13
2 changed files with 687 additions and 5 deletions
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) 2017 PSForever
|
// Copyright (c) 2017 PSForever
|
||||||
package objects
|
package objects
|
||||||
|
|
||||||
import net.psforever.objects.definition.converter.{ACEConverter, REKConverter}
|
import net.psforever.objects.definition.converter.{ACEConverter, CharacterSelectConverter, REKConverter}
|
||||||
import net.psforever.objects._
|
import net.psforever.objects._
|
||||||
import net.psforever.objects.definition._
|
import net.psforever.objects.definition._
|
||||||
import net.psforever.objects.equipment.CItem.{DeployedItem, Unit}
|
import net.psforever.objects.equipment.CItem.{DeployedItem, Unit}
|
||||||
|
|
@ -130,7 +130,7 @@ class ConverterTest extends Specification {
|
||||||
}
|
}
|
||||||
|
|
||||||
"Player" should {
|
"Player" should {
|
||||||
"convert to packet" in {
|
val obj : Player = {
|
||||||
/*
|
/*
|
||||||
Create an AmmoBoxDefinition with which to build two AmmoBoxes
|
Create an AmmoBoxDefinition with which to build two AmmoBoxes
|
||||||
Create a ToolDefinition with which to create a Tool
|
Create a ToolDefinition with which to create a Tool
|
||||||
|
|
@ -157,9 +157,64 @@ class ConverterTest extends Specification {
|
||||||
obj.Slot(2).Equipment = tool
|
obj.Slot(2).Equipment = tool
|
||||||
obj.Slot(5).Equipment.get.GUID = PlanetSideGUID(94)
|
obj.Slot(5).Equipment.get.GUID = PlanetSideGUID(94)
|
||||||
obj.Inventory += 8 -> box2
|
obj.Inventory += 8 -> box2
|
||||||
|
obj
|
||||||
|
}
|
||||||
|
val converter = new CharacterSelectConverter
|
||||||
|
|
||||||
obj.Definition.Packet.DetailedConstructorData(obj).isSuccess mustEqual true
|
"convert to packet (BR < 24)" in {
|
||||||
ok //TODO write more of this test
|
obj.BEP = 0
|
||||||
|
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||||
|
case Success(pkt) =>
|
||||||
|
ok
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
obj.Definition.Packet.ConstructorData(obj) match {
|
||||||
|
case Success(pkt) =>
|
||||||
|
ok
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"convert to packet (BR >= 24)" in {
|
||||||
|
obj.BEP = 10000000
|
||||||
|
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||||
|
case Success(pkt) =>
|
||||||
|
ok
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
obj.Definition.Packet.ConstructorData(obj) match {
|
||||||
|
case Success(pkt) =>
|
||||||
|
ok
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"convert to simple packet (BR < 24)" in {
|
||||||
|
obj.BEP = 0
|
||||||
|
converter.DetailedConstructorData(obj) match {
|
||||||
|
case Success(pkt) =>
|
||||||
|
ok
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
converter.ConstructorData(obj).isFailure mustEqual true
|
||||||
|
converter.ConstructorData(obj).get must throwA[Exception]
|
||||||
|
}
|
||||||
|
|
||||||
|
"convert to simple packet (BR >= 24)" in {
|
||||||
|
obj.BEP = 10000000
|
||||||
|
converter.DetailedConstructorData(obj) match {
|
||||||
|
case Success(pkt) =>
|
||||||
|
ok
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
converter.ConstructorData(obj).isFailure mustEqual true
|
||||||
|
converter.ConstructorData(obj).get must throwA[Exception]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue