mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-06 13:40:21 +00:00
Add Vector3 class
* Add Vector3 class * Add Vector3 test
This commit is contained in:
parent
d2b6a8c451
commit
9d76d08948
3 changed files with 50 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) 2016 PSForever.net to present
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.newcodecs._
|
||||
import net.psforever.types._
|
||||
import scodec.bits._
|
||||
|
||||
class CodecTest extends Specification {
|
||||
|
|
@ -31,4 +32,25 @@ class CodecTest extends Specification {
|
|||
newcodecs.q_double(-256.0, 256.0, 14).encode(257.0).require.bytes mustEqual string_6
|
||||
}
|
||||
}
|
||||
|
||||
"Vector3" should {
|
||||
val string_pos = hex"6E2D762222B616"
|
||||
val string_vel = hex"857D4E0FFFC0"
|
||||
|
||||
"decode position" in {
|
||||
Vector3.codec_pos.decode(string_pos.bits).require.value mustEqual Vector3(3674.859375f, 1092.7656f, 90.84375f)
|
||||
}
|
||||
|
||||
"encode position" in {
|
||||
Vector3.codec_pos.encode(Vector3(3674.859375f, 1092.7656f, 90.84375f)).require.bytes mustEqual string_pos
|
||||
}
|
||||
|
||||
"decode velocity" in {
|
||||
Vector3.codec_vel.decode(string_vel.bits).require.value mustEqual Vector3(-3.84375f, 2.59375f, 255.96875f)
|
||||
}
|
||||
|
||||
"encode velocity" in {
|
||||
Vector3.codec_vel.encode(Vector3(-3.84375f, 2.59375f, 255.96875f)).require.bytes mustEqual string_vel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue