encode and decode of only known packet of the ResetSequence type (#752)

This commit is contained in:
Fate-JH 2021-04-07 14:20:51 -04:00 committed by GitHub
parent 41b3eb5f66
commit b548260257
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 9 deletions

View file

@ -0,0 +1,25 @@
// Copyright (c) 2021 PSForever
package reset
import net.psforever.packet._
import net.psforever.packet.reset.ResetSequence
import org.specs2.mutable._
import scodec.bits._
class ResetSequenceTest extends Specification {
val string = hex"01"
"decode" in {
PacketCoding.decodePacket(string).require match {
case ResetSequence() => ok
case _ => ko
}
}
"encode" in {
val msg = ResetSequence()
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
pkt mustEqual string
}
}