Move the Atlas code into it's own package
This commit is contained in:
parent
8cd7b06c0c
commit
faaa556ad0
8 changed files with 44 additions and 35 deletions
|
@ -3,6 +3,7 @@ package game
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/mdiluz/rove/pkg/atlas"
|
||||
"github.com/mdiluz/rove/pkg/bearing"
|
||||
"github.com/mdiluz/rove/pkg/vector"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -87,7 +88,7 @@ func TestWorld_GetSetMovePosition(t *testing.T) {
|
|||
assert.Equal(t, pos, newAttribs.Pos, "Failed to correctly move position for rover")
|
||||
|
||||
// Place a tile in front of the rover
|
||||
assert.NoError(t, world.Atlas.SetTile(vector.Vector{X: 0, Y: 2}, TileWall))
|
||||
assert.NoError(t, world.Atlas.SetTile(vector.Vector{X: 0, Y: 2}, atlas.TileWall))
|
||||
newAttribs, err = world.MoveRover(a, b)
|
||||
assert.Equal(t, pos, newAttribs.Pos, "Failed to correctly not move position for rover into wall")
|
||||
}
|
||||
|
@ -134,12 +135,12 @@ func TestWorld_RadarFromRover(t *testing.T) {
|
|||
PrintTiles(radar)
|
||||
|
||||
// Test all expected values
|
||||
assert.Equal(t, TileRover, radar[1+fullRange])
|
||||
assert.Equal(t, TileRover, radar[4+4*fullRange])
|
||||
assert.Equal(t, atlas.TileRover, radar[1+fullRange])
|
||||
assert.Equal(t, atlas.TileRover, radar[4+4*fullRange])
|
||||
for i := 0; i < 8; i++ {
|
||||
assert.Equal(t, TileWall, radar[i])
|
||||
assert.Equal(t, TileWall, radar[i+(7*9)])
|
||||
assert.Equal(t, TileWall, radar[i*9])
|
||||
assert.Equal(t, TileWall, radar[(i*9)+7])
|
||||
assert.Equal(t, atlas.TileWall, radar[i])
|
||||
assert.Equal(t, atlas.TileWall, radar[i+(7*9)])
|
||||
assert.Equal(t, atlas.TileWall, radar[i*9])
|
||||
assert.Equal(t, atlas.TileWall, radar[(i*9)+7])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue