Add a function to run a test suite

This commit is contained in:
Alexander Kojevnikov 2013-02-20 22:16:17 -08:00
parent e71dba7c88
commit c96848edc1
3 changed files with 10 additions and 2 deletions

@ -16,7 +16,7 @@
* along with Spek. If not, see <http://www.gnu.org/licenses/>.
*/
#include <spek-utils.h>
#include "spek-utils.h"
#include "test.h"
@ -43,5 +43,5 @@ static void test_vercmp()
void test_utils()
{
test_vercmp();
run(test_vercmp, "vercmp");
}

@ -37,6 +37,12 @@ int main()
}
}
void run(std::function<void ()> func, const std::string& message)
{
std::cerr << message << std::endl;
func();
}
void test(const std::string& message, bool condition)
{
g_total++;

@ -19,8 +19,10 @@
#ifndef TEST_H_
#define TEST_H_
#include <functional>
#include <string>
void run(std::function<void ()> func, const std::string& message);
void test(const std::string& message, bool condition);
template<class T> void test(const std::string& message, const T& expected, const T& actual)