From c96848edc1f0e192a8323b235a2dc04619ac5cd1 Mon Sep 17 00:00:00 2001 From: Alexander Kojevnikov Date: Wed, 20 Feb 2013 22:16:17 -0800 Subject: [PATCH] Add a function to run a test suite --- tests/test-utils.cc | 4 ++-- tests/test.cc | 6 ++++++ tests/test.h | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test-utils.cc b/tests/test-utils.cc index 9f29987..476be64 100644 --- a/tests/test-utils.cc +++ b/tests/test-utils.cc @@ -16,7 +16,7 @@ * along with Spek. If not, see . */ -#include +#include "spek-utils.h" #include "test.h" @@ -43,5 +43,5 @@ static void test_vercmp() void test_utils() { - test_vercmp(); + run(test_vercmp, "vercmp"); } diff --git a/tests/test.cc b/tests/test.cc index 4396d07..2b4d67b 100644 --- a/tests/test.cc +++ b/tests/test.cc @@ -37,6 +37,12 @@ int main() } } +void run(std::function func, const std::string& message) +{ + std::cerr << message << std::endl; + func(); +} + void test(const std::string& message, bool condition) { g_total++; diff --git a/tests/test.h b/tests/test.h index fa31ac9..d168b12 100644 --- a/tests/test.h +++ b/tests/test.h @@ -19,8 +19,10 @@ #ifndef TEST_H_ #define TEST_H_ +#include #include +void run(std::function func, const std::string& message); void test(const std::string& message, bool condition); template void test(const std::string& message, const T& expected, const T& actual)