test for mapobj coord
This commit is contained in:
parent
a0872a82f7
commit
f6979d18c1
33
server/mapobjectdb/accessor_test.go
Normal file
33
server/mapobjectdb/accessor_test.go
Normal file
@ -0,0 +1,33 @@
|
||||
package mapobjectdb
|
||||
|
||||
import (
|
||||
"mapserver/coords"
|
||||
"testing"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
|
||||
func TestNewMapBlockCoords(t *testing.T) {
|
||||
attrs := make(map[string]string)
|
||||
attrs["X"] = "y"
|
||||
|
||||
pos := coords.NewMapBlockCoords(1, 2, 3)
|
||||
fmt.Println(pos)
|
||||
|
||||
obj := NewMapObject(&pos, 10, 12, 14, "xy")
|
||||
fmt.Println(obj)
|
||||
|
||||
if obj.X != 26 {
|
||||
t.Error("x coord off")
|
||||
}
|
||||
|
||||
if obj.Y != 44 {
|
||||
t.Error("Y coord off")
|
||||
}
|
||||
|
||||
if obj.Z != 62 {
|
||||
t.Error("Z coord off")
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -90,9 +90,9 @@ func TestMapObjects(t *testing.T) {
|
||||
|
||||
o := mapobjectdb.MapObject{
|
||||
MBPos: &pos,
|
||||
X: 1,
|
||||
Y: 2,
|
||||
Z: 3,
|
||||
X: 15,
|
||||
Y: 15,
|
||||
Z: 15,
|
||||
Type: "xy",
|
||||
Mtime: 1234,
|
||||
Attributes: attrs,
|
||||
|
Loading…
Reference in New Issue
Block a user