-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
Description
This was motivated by #1159 . Prior to this I had never looked very closely at Z3's unit tests. Doing so has revealed several problems that need addressing.
- The tests seem rely on SASSERT(). That's a no-op in non debug builds, right? That doesn't seem like a great idea because that means we don't know if the checks actually pass on a release build.
- src/test/hashtable.cpp seems to redefine SASSERT() and that implementation isn't particularly good because it doesn't halt execution with a non zero exit code which means we'll easily miss any failures here.
- Several of the tests have
#ifdef _WINDOWS(e.g.src/test/api.cpp) guarding them with no obvious reason why. This means lots of things won't get tested on TravisCI because that uses Linux.
While I'm here I've also observed that we seem to be using a "homegrown" unit testing framework. I would suggest that part of the solution here is to use a well tested and widely used unit testing framework rather than rolling our own.
Example C++ unit testing frameworks include
- GoogleTest I've used this one. It's also used by LLVM.
- Boost.test
- Catch
My preference would be GoogleTest but that's only because it's the only C++ unit test framework I've used before. Other suggestions are welcome.