test for mapobj coord

This commit is contained in:
NatureFreshMilk 2019-02-06 08:09:21 +01:00
parent a0872a82f7
commit f6979d18c1
2 changed files with 36 additions and 3 deletions

View 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")
}
}

View File

@ -90,9 +90,9 @@ func TestMapObjects(t *testing.T) {
o := mapobjectdb.MapObject{ o := mapobjectdb.MapObject{
MBPos: &pos, MBPos: &pos,
X: 1, X: 15,
Y: 2, Y: 15,
Z: 3, Z: 15,
Type: "xy", Type: "xy",
Mtime: 1234, Mtime: 1234,
Attributes: attrs, Attributes: attrs,