2019-07-31 12:36:30 +03:00
|
|
|
package coords
|
|
|
|
|
|
|
|
import (
|
2023-12-29 18:00:11 +03:00
|
|
|
"mapserver/types"
|
2019-07-31 12:36:30 +03:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewMapBlockCoordsFromBlock(t *testing.T) {
|
2023-12-29 18:00:11 +03:00
|
|
|
c := types.NewMapBlockCoordsFromBlock(1, 1, 1)
|
2019-07-31 12:36:30 +03:00
|
|
|
|
|
|
|
if c.X != 0 || c.Y != 0 || c.Z != 0 {
|
|
|
|
t.Fatal("mismatch", c)
|
|
|
|
}
|
|
|
|
|
2023-12-29 18:00:11 +03:00
|
|
|
c = types.NewMapBlockCoordsFromBlock(16, 1, 1)
|
2019-07-31 12:36:30 +03:00
|
|
|
|
|
|
|
if c.X != 1 || c.Y != 0 || c.Z != 0 {
|
|
|
|
t.Fatal("mismatch", c)
|
|
|
|
}
|
|
|
|
|
2023-12-29 18:00:11 +03:00
|
|
|
c = types.NewMapBlockCoordsFromBlock(16, 1, -1)
|
2019-07-31 12:36:30 +03:00
|
|
|
|
|
|
|
if c.X != 1 || c.Y != 0 || c.Z != -1 {
|
|
|
|
t.Fatal("mismatch", c)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|