28#ifndef PT_UNIT_TESTMETHOD_H
29#define PT_UNIT_TESTMETHOD_H
31#include <Pt/Unit/Api.h>
32#include <Pt/Unit/Test.h>
33#include <Pt/SerializationInfo.h>
34#include <Pt/TypeTraits.h>
44 class TestMethod :
public Pt::Unit::Test
47 TestMethod(
const std::string& name)
48 : Pt::Unit::
Test(name)
56 void setArgs(
const SerializationInfo* si, std::size_t argCount)
62 const SerializationInfo* args()
const
65 std::size_t argCount()
const
69 const SerializationInfo* _args;
70 std::size_t _argCount;
75 typename A1 = Pt::Void,
76 typename A2 = Pt::Void,
77 typename A3 = Pt::Void,
78 typename A4 = Pt::Void,
79 typename A5 = Pt::Void,
80 typename A6 = Pt::Void,
81 typename A7 = Pt::Void,
82 typename A8 = Pt::Void >
83 class BasicTestMethod :
public Pt::Method<void, C, A1, A2, A3, A4, A5, A6, A7, A8>
88 typedef void (C::*MemFuncT)(A1, A2, A3, A4, A5, A6, A7, A8);
100 BasicTestMethod(
const std::string& name, C&
object, MemFuncT ptr)
101 : Pt::
Method<void, C, A1, A2, A3, A4, A5, A6, A7, A8>(
object, ptr)
107 const SerializationInfo* args = this->args();
108 std::size_t argCount = this->argCount();
111 throw std::invalid_argument(
"invalid number of arguments");
148 class BasicTestMethod<C,
156 Pt::Void> :
public Pt::Method<void, C, A1, A2, A3, A4, A5>
161 typedef void (C::*MemFuncT)(A1, A2, A3, A4, A5);
170 BasicTestMethod(
const std::string& name, C&
object, MemFuncT ptr)
177 const SerializationInfo* args = this->args();
178 std::size_t argCount = this->argCount();
181 throw std::invalid_argument(
"invalid number of arguments");
198 Pt::Method<void, C, A1, A2, A3, A4, A5>::call(v1, v2, v3, v4, v5);
208 class BasicTestMethod<C,
216 Pt::Void> :
public Pt::Method<void, C, A1, A2, A3, A4>
221 typedef void (C::*MemFuncT)(A1, A2, A3, A4);
229 BasicTestMethod(
const std::string& name, C&
object, MemFuncT ptr)
236 const SerializationInfo* args = this->args();
237 std::size_t argCount = this->argCount();
240 throw std::invalid_argument(
"invalid number of arguments");
263 class BasicTestMethod<C,
271 Pt::Void> :
public Pt::Method<void, C, A1, A2, A3>
276 typedef void (C::*MemFuncT)(A1, A2, A3);
283 BasicTestMethod(
const std::string& name, C&
object, MemFuncT ptr)
290 const SerializationInfo* args = this->args();
291 std::size_t argCount = this->argCount();
294 throw std::invalid_argument(
"invalid number of arguments");
313 class BasicTestMethod<C,
321 Pt::Void> :
public Pt::Method<void, C, A1, A2>
326 typedef void (C::*MemFuncT)(A1, A2);
332 BasicTestMethod(
const std::string& name, C&
object, MemFuncT ptr)
339 const SerializationInfo* args = this->args();
340 std::size_t argCount = this->argCount();
343 throw std::invalid_argument(
"invalid number of arguments");
358 class BasicTestMethod<C,
366 Pt::Void> :
public Pt::Method<void, C, A1>
371 typedef void (C::*MemFuncT)(A1);
376 BasicTestMethod(
const std::string& name, C&
object, MemFuncT ptr)
383 const SerializationInfo* args = this->args();
384 std::size_t argCount = this->argCount();
387 throw std::invalid_argument(
"invalid number of arguments");
397 class BasicTestMethod<C,
405 Pt::Void> :
public Pt::Method<void, C>
410 typedef void (C::*MemFuncT)();
413 BasicTestMethod(
const std::string& name, C&
object, MemFuncT ptr)
C & object()
Definition Method.h:64
Method(C &object, MemFuncT method)
Definition Method.h:57
R call(As... args) const
Calls the callable entity and returns its result.
Definition Method.h:84
Test(const std::string &name)
Construct a test by name.
Definition Test.h:145
Protocol and data driven unit testing framework.
Core module.
Definition Allocator.h:33
IMPLEMENTATION_DEFINED Value
The derived value type.
Definition Api-TypeTraits.h:40