Permalink
Browse files

Add multi_tests with 4 parameters.

  • Loading branch information...
1 parent fa417f0 commit 8f9fe3f9284bdbc2452a961445ddd8e1ad2d78d4 @thomasmoelhave committed with Mortal Oct 17, 2012
Showing with 31 additions and 0 deletions.
  1. +31 −0 tpie/unittest.h
View
@@ -149,6 +149,12 @@ class tests {
const std::string & p2_name, T2 p2_default,
const std::string & p3_name, T3 p3_default);
+ template <typename T, typename T1, typename T2, typename T3, typename T4>
+ tests & multi_test(T fct, const std::string & name,
+ const std::string & p1_name, T1 p1_default,
+ const std::string & p2_name, T2 p2_default,
+ const std::string & p3_name, T3 p3_default,
+ const std::string & p4_name, T4 p4_default);
operator int();
protected:
@@ -486,6 +492,31 @@ tests & tests::multi_test(T fct, const std::string & name,
return *this;
}
+template <typename T, typename T1, typename T2, typename T3, typename T4>
+tests & tests::multi_test(T fct, const std::string & name,
+ const std::string & p1_name, T1 p1_default,
+ const std::string & p2_name, T2 p2_default,
+ const std::string & p3_name, T3 p3_default,
+ const std::string & p4_name, T4 p4_default) {
+ m_tests.push_back(name+
+ arg_str(p1_name, p1_default) +
+ arg_str(p2_name, p2_default) +
+ arg_str(p3_name, p3_default) +
+ arg_str(p4_name, p4_default));
+
+ if (testAll || name == test_name) {
+ start_test(name);
+ teststream ts;
+ fct(ts,
+ get_arg(p1_name, p1_default),
+ get_arg(p2_name, p2_default),
+ get_arg(p3_name, p3_default),
+ get_arg(p4_name, p4_default));
+ end_test(ts.success());
+ }
+ return *this;
+}
+
template <typename T>
tests & tests::setup(T t) {
setups.push_back(new func_impl<T>(t));

0 comments on commit 8f9fe3f

Please sign in to comment.