spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit c96848edc1f0e192a8323b235a2dc04619ac5cd1
parent e71dba7c88cd967d7a8e9b6f4eb9576eaa689de5
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Wed, 20 Feb 2013 22:16:17 -0800

Add a function to run a test suite

Diffstat:
Mtests/test-utils.cc | 4++--
Mtests/test.cc | 6++++++
Mtests/test.h | 2++
3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/test-utils.cc b/tests/test-utils.cc @@ -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"); } diff --git a/tests/test.cc b/tests/test.cc @@ -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++; diff --git a/tests/test.h b/tests/test.h @@ -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)