# Tests & Docs
Details on testing, documentation, and benchmarks.
# Tests
The Rust Toolchain comes with built in testing and documentation tool, they can even be combined. Now, there aren't a lot of tests in source code at the time of writing, as a lot of it is OpenGL code, which is notoriously hard to ensure robustness because of the multitude of versions and implementations. However, a few test experiments were completed as part of a bit of documentation, as rust will compile doc-comment example code and run it as integration tests.
# Documentation
There also isn't a lot of source code documentation available, but Cargo can generate API documentation from the source code into a web page. So, when code is pushed to the GitHub repository, it's built, tested, and the documentation is generated and put up on this website here (opens new window).
# Benchmarks
Cargo has benchmark tests in nightly preview at the moment, but the criterion
crate exists to aid in benchmarking functions in the meantime. The benchmarks run a some arbitrary code a bunch of times — generally thousands — and takes a sample of those to compare to the previous run, so the developer can track performance trends. These benchmarks have been used to improve the performance of the Transform
matrix calculation (which runs thousands of times a frame), and confirm where multi-threading improves performance (mainly by parallelising all those matrix transformations).