SFML / CSFML

Official binding of SFML for C
https://www.sfml-dev.org
Other
343 stars 123 forks source link

Add unit testing infrastructure and initial unit tests #243

Closed ChrisThrasher closed 5 months ago

ChrisThrasher commented 5 months ago

Waiting on #242

For the most part this PR copies over the same testing infrastructure that SFML already uses. The unit tests themselves are written in C++ because C++ provides more options for writing expressive tests plus it means more in similar with SFML's tests which makes for easier maintenance. Writing our tests in pure C would not be particularly useful.

I had to make a few changes to how rpaths are treated to get the tests to work. CMake's default handling of rpaths seems to work just fine but the custom settings we were using were breaking things. I'm not sure why CMAKE_SKIP_BUILD_RPATH was enabled but I feel comfortable removing that. Build-time rpaths are useful. I'm also not sure why BUILD_WITH_INSTALL_RPATH was enabled for macOS dylibs but I also had to remove that to get the tests to work on macOS.