thermodynamic v1

This commit is contained in:
zomseffen 2020-11-08 10:20:23 +01:00
parent 5168061d1b
commit 41761b7b56
16 changed files with 1025 additions and 212 deletions

6
tests/test_Client.py Normal file
View file

@ -0,0 +1,6 @@
from Client.Client import Client
from WorldProvider.WorldProvider import WorldProvider
def test_client_init():
wp = WorldProvider()
client = Client(wp, test=True)

59
tests/test_Structures.py Normal file
View file

@ -0,0 +1,59 @@
from Lights.Lights import Light
from Objects.Objects import Object
from Objects.World import World
def test_world_put_object():
w = World(5, 5, 5, 3, 3, 3)
o = Object()
w.put_object(5, 5, 5, o)
assert w.chunks[1][1][1].content[0][0][0] == o, 'Put Object into world failed'
def test_world_get_object():
w = World(5, 5, 5, 3, 3, 3)
o = Object()
w.put_object(5, 5, 5, o)
assert w.get_object(5, 5, 5) == o, 'Put Object into world failed'
def test_world_put_visibility():
w = World(5, 5, 5, 3, 3, 3)
o = Object()
w.put_object(4, 5, 5, o)
w.put_object(6, 5, 5, o)
w.put_object(5, 4, 5, o)
w.put_object(5, 6, 5, o)
w.put_object(5, 5, 4, o)
w.put_object(5, 5, 6, o)
w.put_object(5, 5, 5, o)
assert w.chunks[1][1][1].visible[0][0][0] == 0, 'Initial visibility not set!'
assert w.chunks[1][1][1].visible[1][0][0] == 5, 'Neighbours visibility not set!'
assert w.chunks[1][1][1].visible[0][1][0] == 5, 'Neighbours visibility not set!'
assert w.chunks[1][1][1].visible[0][0][1] == 5, 'Neighbours visibility not set!'
assert w.chunks[0][1][1].visible[4][0][0] == 5, 'Neighbours visibility not set!'
assert w.chunks[1][0][1].visible[0][4][0] == 5, 'Neighbours visibility not set!'
assert w.chunks[1][1][0].visible[0][0][4] == 5, 'Neighbours visibility not set!'
def test_world_add_light():
w = World(5, 5, 5, 3, 3, 3)
l = Light()
w.add_light(1.5, 2, 3.7, l)
def test_world_remove_light():
w = World(5, 5, 5, 3, 3, 3)
l = Light()
w.add_light(1.5, 2, 3.7, l)
w.remove_light(l)