Skip to content

Commit

Permalink
Try initial test of Gym wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
cpondoc committed Jan 16, 2024
1 parent 4b84c5d commit fa988e9
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/package_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Testing the OpenAI Gym Package itself.
"""
import gymnasium
import numpy as np
import wildfire_evac

def test_constructor():
"""
Test the constructor to make sure all variables are accounted for.
"""
# Set up parameters
num_rows, num_cols = 10, 10
populated_areas = np.array([[1,2],[4,8], [6,4], [8, 7]])
paths = np.array([[[1,0],[1,1]], [[2,2],[3,2],[4,2],[4,1],[4,0]], [[2,9],[2,8],[3,8]], [[5,8],[6,8],[6,9]], [[7,7], [6,7], [6,8], [6,9]], [[8,6], [8,5], [9,5]], [[8,5], [9,5], [7,5],[7,4]]], dtype=object)
paths_to_pops = {0:[[1,2]], 1:[[1,2]], 2: [[4,8]], 3:[[4,8]], 4:[[8, 7]], 5:[[8, 7]], 6:[[6,4]]}

# Create environment
kwargs = {
'num_rows': num_rows,
'num_cols': num_cols,
'populated_areas': populated_areas,
'paths': paths,
'paths_to_pops': paths_to_pops
}
env = gymnasium.make('wildfire_evac/WildfireEvacuation-v0', **kwargs)

# Make basic checks
assert(env.num_rows == num_rows)

0 comments on commit fa988e9

Please sign in to comment.