Serialise the World as well
This commit is contained in:
parent
50c970fea2
commit
68d117e0d8
5 changed files with 76 additions and 31 deletions
|
@ -1,26 +1,27 @@
|
|||
package game
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewWorld(t *testing.T) {
|
||||
// Very basic for now, nothing to verify
|
||||
world := NewWorld()
|
||||
world := NewWorld(os.TempDir())
|
||||
if world == nil {
|
||||
t.Error("Failed to create world")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWorld_CreateInstance(t *testing.T) {
|
||||
world := NewWorld()
|
||||
world := NewWorld(os.TempDir())
|
||||
a := world.CreateInstance()
|
||||
b := world.CreateInstance()
|
||||
|
||||
// Basic duplicate check
|
||||
if a == b {
|
||||
t.Errorf("Created identical instances")
|
||||
} else if len(world.instances) != 2 {
|
||||
} else if len(world.Instances) != 2 {
|
||||
t.Errorf("Incorrect number of instances created")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue