work on BugReportMessage packet and tests

This commit is contained in:
FateJH 2017-01-21 18:05:58 -05:00
parent 491e263f71
commit 1bf189b34f
3 changed files with 107 additions and 1 deletions

View file

@ -1325,6 +1325,38 @@ class GamePacketTest extends Specification {
}
}
"BugReportMessage" should {
val string = hex"89 03000000 0F000000 8B4465632020322032303039 1 1 0 19 6C511 656B1 7A11 830610062006300 843100320033003400"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case BugReportMessage(major, minor, date, btype, repeat, unk, zone, loc, summary, desc) =>
major mustEqual 3
minor mustEqual 15
date mustEqual "Dec 2 2009"
btype mustEqual BugType.GAMEPLAY
repeat mustEqual true
zone mustEqual 25
loc.x mustEqual 674.84375f
loc.y mustEqual 726.78906f
loc.z mustEqual 69.90625f
summary mustEqual "abc"
desc mustEqual "1234"
case default =>
ko
}
}
"encode" in {
val msg = BugReportMessage(3, 15, "Dec 2 2009",
BugType.GAMEPLAY, true, 0, 25, Vector3(674.84375f, 726.78906f, 69.90625f),
"abc", "1234")
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}
"ContinentalLockUpdateMessage" should {
val string = hex"A8 16 00 40"