You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
529 B
32 lines
529 B
package world |
|
|
|
import "testing" |
|
|
|
const ( |
|
EntityNone = iota |
|
EntityFloor |
|
EntityWall |
|
EntityCeiling |
|
EntityActor |
|
) |
|
|
|
func TestMap(t *testing.T) { |
|
m := NewMap() |
|
|
|
e := NewEntity(EntityFloor) |
|
m.Add(e, 0, 0, 0) |
|
|
|
c := m.Contents() |
|
found := 0 |
|
for position, entity := range c { |
|
if entity.Is(EntityFloor) { |
|
if position != "0,0,0" { |
|
t.Errorf("unexpected position: wanted %s, got %s", "0,0,0", position) |
|
} |
|
found++ |
|
} |
|
} |
|
if found != 1 { |
|
t.Errorf("unexpected number of floor tiles: wanted %d, got %d", 1, found) |
|
} |
|
}
|
|
|