mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-03-03 12:30:24 +00:00
29 lines
663 B
Scala
29 lines
663 B
Scala
// Copyright (c) 2017 PSForever
|
|
package game
|
|
|
|
import org.specs2.mutable._
|
|
import net.psforever.packet._
|
|
import net.psforever.packet.game._
|
|
import scodec.bits._
|
|
|
|
class FriendsRequestTest extends Specification {
|
|
val string = hex"72 3 0A0 46004A0048004E004300"
|
|
|
|
"decode" in {
|
|
PacketCoding.DecodePacket(string).require match {
|
|
case FriendsRequest(action, friend) =>
|
|
action mustEqual 1
|
|
friend.length mustEqual 5
|
|
friend mustEqual "FJHNC"
|
|
case _ =>
|
|
ko
|
|
}
|
|
}
|
|
|
|
"encode" in {
|
|
val msg = FriendsRequest(1, "FJHNC")
|
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
|
|
|
pkt mustEqual string
|
|
}
|
|
}
|