Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Unit test framework
Welcome to cppocl/test which is where the C++ unit test framework can be found. To use this only requires including Test.hpp for each source code file that has unit tests, and TestClass.cpp needs to be added to the makefile or project file.
This framework is tested on a C++ 98 and C++ 11 compiler, so should be usable by older projects or embedded Linux systems using various C++ cross compilers.
This seems to be fairly stable, and has been used by myself for many months now, but I am still continuing with improvements and writing unit tests to test the unit test framework.
This framework is designed to test functions, member functions and also be able to write performance tests which can then be examined in the report generated by the framework to stdio.
Please let me know if you find and bugs and I will fix them. I will also consider any new feature requests, but I am not looking for contributors at the moment.
There is also a document that explains the features of the framework in the test folder.
- Perform checks such as true, false, <, >, ==, !=, etc. on general tests, functions and member functions.
- Test performance of general tests, functions or member functions.
- Check if exception is or is not thrown
- Detect test failures from main function
- Logging to stdout and stderr
- Header only library with only Test.hpp needing to be included
- Written to be easy to write tests
- Library can be stored in any folder as files are relative to Test.hpp
- Builds on Linux and Windows 32/64 bit. Tested with Cygwin, gcc, MS Visual C++ 2005/2015.
- Compliant with C++ 98 and C++ 11
- Custom logging
This is a list of features that will be added to the unit test framework:
- Break on error
- Output failures in IDE friendly format
Project Source Code
Code can be found here: https://github.com/cppocl/cppocl/tree/master/test