1 #ifndef MSP_TEST_TESTFUNCTION_H_
2 #define MSP_TEST_TESTFUNCTION_H_
5 #include "exceptioncheck.h"
15 std::string description;
16 ExceptionCheck *exc_check;
19 Function(const std::string &);
23 const std::string &get_description() const { return description; }
26 Function &expect_throw() { exc_check = new ExceptionTypeCheck<T>; return *this; }
28 const ExceptionCheck *get_exception_check() const { return exc_check; }
30 virtual void run(Test &) const = 0;
34 class TypedFunction: public Function
37 typedef void (T::*FuncPtr)();
42 TypedFunction(FuncPtr f, const std::string &d):
47 virtual void run(Test &t) const
49 (dynamic_cast<T &>(t).*func)();
53 template<typename T, typename A>
54 class TypedFunction1: public Function
57 typedef void (T::*FuncPtr)(A);
63 TypedFunction1(FuncPtr f, const A &a, const std::string &d):
69 virtual void run(Test &t) const
71 (dynamic_cast<T &>(t).*func)(arg);