Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Basically I try to reopen #7254 which is closed. One of the final notes made in that PR is that we cannot have the Makefile rely on system dependent file paths. One of the proposed ways to achieve this is to add googletest as a submodule.
For now, I believe this is the easiest way to achieve the possibility to add unittests to OpenTTD. As I do not see anyone in the near future integrate googletests through autotools, or make OpenTTD use CMake.
I think it is good to have some framework in place to add unittests to OpenTTD. Many things are difficult to test within OpenTTD, but there are some things which you can test, for example #7735 requires some URI parser which should be testable.
There was some discussion about introducing unit tests to OpenTTD on irc. Here's a proof of concept with some unit tests for a few basic math functions. To run these tests, you need to install [Googletest](https://github.com/google/googletest). On Debian you can do an `apt install googletest`. Then you should be able to run them by going to the `test` directory and running `./test-all.sh`. If we go further down this route we can of course set these up with the CI stuff like Azure.
LordAro left a comment
I do like this, though I (still) have a few general thoughts: