/* * tester.hpp * * Created on: Oct 21, 2011 * Author: mike */ #pragma once #include "stopwatch.hpp" // Macro to call the member function // referenced by a member function pointer #define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember)) //----------------------------------------------------------------------- class Tester { private: StopWatch sw; typedef void(Tester::*TestFunction)(); HirezTime measureRuntime(TestFunction test); // ====================================================================== // Application-specific test code // Type of member function pointer for class Tester struct TestPair { string name; TestFunction test; }; // Static constants static const unsigned defaultSeed; static const int defaultIterations; static const TestPair testSuite[]; //------------------------------------------------------------------- // Data members const int iterations; const unsigned seed; void runOneTest(const TestPair& tp); void test1(); void test2(); public: Tester(int it = defaultIterations, unsigned s = defaultSeed) : iterations(it), seed(s) { } void runAllTests(); };