func TestPlayerSaveLoad(t *testing.T) {
	p := MakePlayer(1, "test-player", vector.Vector2{-1, 1})
	p.Token = "waffle"
	defer func() {
		os.Remove("testpath")
	}()
	err := fileSystem.Save("testpath", p)
	unittest.CheckNil(t, &err)
	p2, err := fileSystem.LoadPlayer("testpath")
	unittest.CheckNil(t, &err)
	unittest.CheckDeepEqual(t, *p, *p2)
}
func TestMkdir(t *testing.T) {
	exists, _ := fileSystem.FileExists("testdir")
	unittest.CheckFalse(t, exists)

	err := fileSystem.Mkdir("testdir")
	unittest.CheckNil(t, &err)
	defer func() {
		os.Remove("testdir")
	}()
	exists, _ = fileSystem.FileExists("testdir")
	unittest.Check(t, exists)
}
func TestChunkSerialization(t *testing.T) {
	serial := initChunk.MarshalGame()
	f, err := os.Create("chunk.json")
	unittest.CheckNil(t, &err)
	defer func() {
		os.Remove("chunk.json")
	}()
	fmt.Fprintf(f, "%s", serial)
	f.Close()

	f2, err2 := os.Open("chunk.json")
	defer f2.Close()
	f2Stats, _ := f2.Stat()
	bytes := make([]byte, f2Stats.Size())
	f2.Read(bytes)
	unittest.CheckNil(t, &err2)
	newChunk := &GameChunk{}
	serr := newChunk.UnmarshalGame(bytes)
	unittest.CheckNil(t, &serr)

	unittest.CheckDeepEqual(t, *newChunk, *initChunk)
}
func TestFileExists(t *testing.T) {
	exists, _ := fileSystem.FileExists("testpath")
	unittest.CheckFalse(t, exists)

	p := MakePlayer(1, "test-player", vector.Vector2{-1, 1})
	p.Token = "waffle"
	defer func() {
		os.Remove("testpath")
	}()
	err := fileSystem.Save("testpath", p)
	unittest.CheckNil(t, &err)
	exists, _ = fileSystem.FileExists("testpath")
	unittest.Check(t, exists)
}