Skip to content

GameMap Test Plan

RileyWhitty edited this page Sep 12, 2023 · 4 revisions

To test the GameMap class, a dummy 4x4 map (constructed using a TiledMapTileLayer) was used. It was then populated with 16 tiles in a certain order.

The main focus of the tests were on the getTile, vectorToTileCoordinates, tileCoordinatesToVector, getTraversableTileCoordinates and getNonTraversableTileCoordinates methods.

To test the getTile method, 9 tests were made to test if the getTile method worked on the edge tiles of the map, the edge rows of tiles of the map and the internal tiles of the map (the ones which are not in any of the edge rows). This tests that getTile method works anywhere on a given map.

For the vectorToTileCoordinates method one test was made which tested the conversion of all possible Vectors on the map to Gridpoints.

For the tileCoordinatesToVector method one test was made which tested the conversion of all possible Gridpoints (tile x, y positions) on the map to Vectors.

For the getTraversableTileCoordinates method, two tests were made. One tested to ensure that all of the traversable tile coordinates were included in the returned Array List and the other tested to ensure that none of the non-traversable tile coordinated were included in the returned Array List.

For the getNonTraversableTileCoordinates method, two tests were made. One tested to ensure that all of the non-traversable tile coordinates were included in the returned Array List and the other tested to ensure that none of the traversable tile coordinated were included in the returned Array List.

Clone this wiki locally