Skip to content

Latest commit

 

History

History
21 lines (11 loc) · 1.41 KB

testreport.md

File metadata and controls

21 lines (11 loc) · 1.41 KB

Testing report

Unit testing

The minimax algorithm and the game board have many complex functions where it is not intuitively clear that they work correctly. For this reason they need to be properly unit tested.

Currently, the board code is very thoroughly tested. Most of the tests test the heuristic evaluation function, as it needs to satisfy certain conditions. For example, the heuristic needs to always evaluate a winning state higher than any non-winning state. The boards for testing the functions have been selected to contain as many corner cases as possible.

The minimax algorithm/AI code is hard to test because it is not completely deterministic, and also because it is not required to be particularly skilled at the game. Nevertheless there are a few tests for some trivial cases where any sensible AI should produce the same results.

Test coverage

Up-to-date test coverage report can be found in codecov.io. It is automatically generated for each commit in Github Actions.

Implementation

The unit tests are in the src/tests.rs file.

They can be run by executing the command cargo test in the project folder.

Code coverage report can be generated by installing Tarpaulin and running it. Github Actions also automatically generates a code coverage report using Tarpaulin and uploads it into codecov.io.