comp10001-project02/part4.py

30 lines
1.9 KiB
Python
Raw Permalink Normal View History

# Title: Project 2 - Test cases
# Author: Rory Healy
# Date created - 9th May 2019
from testcase_tournament import test_fn as test_run_model
# 1) Tests if the model decreases the fuel_load of each cell by 1 for each
# timestep.
test_run_model([[[3, 2, 5], [1, 1, 5], [4, 2, 7]], [[1, 1, 1], [1, 1, 1], [1, 1, 1]], 1, None, [(1, 1)]], [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], 9])
# 2) Tests if the model decreases the fuel_load of each cell when the ignition
# threshold is increased.
test_run_model([[[2, 2, 2], [2, 1, 2], [2, 2, 2]], [[1, 1, 1], [1, 1, 1], [1, 1, 1]], 2, None, [(1, 1)]], [[[2, 2, 2], [2, 0, 2], [2, 2, 2]], 1])
# 3) Tests if the wind affects the number of adjacent cells that would catch
# on fire.
test_run_model([[[2, 2, 2], [2, 1, 2], [2, 2, 2]], [[1, 1, 1], [1, 1, 1], [1, 1, 1]], 1, 'NW', [(2, 2)]], [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], 9])
# 4) and 5) Tests examples given in Q3. These will test how multiple changes to
# the input values affect the resulting output, such as changing f_grid,
# w_direction, and i_threshold.
test_run_model([[[2, 2], [2, 2]], [[1, 1], [1, 1]], 1, 'N', [(0, 0)]], [[[0, 0], [0, 0]], 4])
test_run_model([[[2, 0], [0, 2]], [[1, 1], [1, 1]], 2, 'S', [(0, 0)]], [[[0, 0], [0, 2]], 1])
# 6) Mutations of tests 4) and 5), but changing height as well as burn_seeds.
test_run_model([[[2, 1], [1, 3]], [[1, 2], [1, 2]], 1, 'N', [(1, 0)]], [[[0, 0], [0, 0]], 4])
# 7) Testing a really large matrix size.
test_run_model([[[1, 1, 1, 2, 2, 2, 3], [3, 2, 3, 4, 3, 1, 2], [6, 2, 8, 1, 3, 1, 2], [2, 2, 1, 3, 4, 2, 1], [2, 3, 2, 1, 2, 1, 3], [1, 1, 1, 1, 2, 1, 1], [1, 1, 1, 1, 1, 1, 1]], [[1, 1, 1, 2, 2, 2, 3], [1, 1, 2, 2, 3, 3, 4], [1, 2, 2, 3, 4, 4, 3], [1, 2, 3, 3, 4, 3, 2], [1, 2, 2, 3, 4, 3, 2], [1, 2, 2, 3, 4, 4, 3], [1, 1, 2, 2, 3, 3, 4]], 1, 'N', [(3, 5)]], [[[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]], 49])