51 lines
1.0 KiB
Python
51 lines
1.0 KiB
Python
|
|
#!/usr/bin/env python3
|
|
|
|
"""
|
|
Grid provides space for game to occur, partitions based on proximity allowing for optimizations
|
|
"""
|
|
|
|
import numpy as np
|
|
from numpy.typing import NDArray
|
|
from typing import List, Tuple, Optional
|
|
import math
|
|
import pytest
|
|
|
|
from antikythera.engine.entity import Entity
|
|
from antikythera.engine.game import Game
|
|
|
|
|
|
class TestGameCreation:
|
|
|
|
@pytest.fixture
|
|
def game(self):
|
|
return Game(x = 512, y = 512)
|
|
|
|
# legal coords
|
|
@pytest.mark.parametrize("x,y", [
|
|
(1,1),
|
|
(100,100),
|
|
(512,128),
|
|
])
|
|
|
|
def test_game_create(self, x, y):
|
|
"""testing that inserting entity at valid pos succeeds"""
|
|
g = Game(x, y)
|
|
|
|
assert g.x == x
|
|
assert g.y == y
|
|
|
|
# illegal game bounds
|
|
@pytest.mark.parametrize("x,y", [
|
|
(0, 0),
|
|
(100,-100),
|
|
(-100, 100),
|
|
(-100, -100),
|
|
])
|
|
|
|
def test_game_create_fail(self, x, y):
|
|
"""testing that creating invalid game board fails"""
|
|
|
|
with pytest.raises(ValueError):
|
|
Game(x, y)
|