Skip to content

Unit tests need clean up #1163

@delcypher

Description

@delcypher

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

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions