func TestMakeWorldMap(t *testing.T) {
	unittest.CheckEqual(t, testWorldMap.width, uint(5))
	unittest.CheckEqual(t, testWorldMap.height, uint(10))
	for y := 0; y < 10; y++ {
		for x := 0; x < 5; x++ {
			unittest.CheckFalse(t, testWorldMap.grid[x][y])
		}
	}
}
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 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)
}
Exemple #4
0
func TestHasTokenBadLogin(t *testing.T) {
	p.loginState = TOKEN_RECEIVED
	unittest.CheckFalse(t, p.Login("bad"))
	unittest.Check(t, p.IsOffline())
}
Exemple #5
0
func TestOnlineLogin(t *testing.T) {
	p.loginState = ONLINE
	unittest.CheckFalse(t, p.Login(""))
}
Exemple #6
0
func TestOfflineLogin(t *testing.T) {
	unittest.Check(t, p.IsOffline())
	unittest.CheckFalse(t, p.Login(""))
}
Exemple #7
0
func TestHealthIsDead(t *testing.T) {
	unittest.Check(t, MakeHealth(0).IsDead())
	unittest.CheckFalse(t, MakeHealth(5).IsDead())
}