using c++11 variadic templates for the templated test cases! relates #137 and #38
this also means less compilers will be usable for doctest 2.0
diff --git a/examples/all_features/templated_test_cases.cpp b/examples/all_features/templated_test_cases.cpp
index 05baa75..7dc501e 100644
--- a/examples/all_features/templated_test_cases.cpp
+++ b/examples/all_features/templated_test_cases.cpp
@@ -4,15 +4,11 @@
#include <vector>
DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END
-// typedefs are required if variadic macro support is not available (otherwise the commas are a problem)
-typedef doctest::Types<signed char, short, int> int_types;
-typedef doctest::Types<double, double> float_types; // note that types won't be filtered for uniqueness
-
// =================================================================================================
// NORMAL TEMPLATED TEST CASES
// =================================================================================================
-TEST_CASE_TEMPLATE("signed integers stuff", T, int_types) {
+TEST_CASE_TEMPLATE("signed integers stuff", T, signed char, short, int) {
T var = T();
--var;
CHECK(var == -1);
@@ -21,7 +17,7 @@
// teach the library how to stringify this type - otherwise <> will be used
TYPE_TO_STRING(std::vector<int>);
-TEST_CASE_TEMPLATE("vector stuff", T, doctest::Types<std::vector<int> >) {
+TEST_CASE_TEMPLATE("vector stuff", T, std::vector<int>) {
T vec(10);
CHECK(vec.size() == 20); // will fail
}
@@ -35,8 +31,8 @@
CHECK(doctest::Approx(var) == T());
}
-TEST_CASE_TEMPLATE_INSTANTIATE(test_id, int_types);
-TEST_CASE_TEMPLATE_INSTANTIATE(test_id, float_types);
+TEST_CASE_TEMPLATE_INSTANTIATE(test_id, signed char, short, int);
+TEST_CASE_TEMPLATE_INSTANTIATE(test_id, double, double); // note that types won't be filtered for uniqueness
// =================================================================================================
// MULTIPLE TYPES AS PARAMETERS
@@ -49,11 +45,10 @@
typedef second B;
};
-typedef doctest::Types<
- TypePair<int, char>,
- TypePair<char, int>,
+#define pairs \
+ TypePair<int, char>, \
+ TypePair<char, int>, \
TypePair<bool, int>
-> pairs;
TEST_CASE_TEMPLATE("multiple types", T, pairs) {
typedef typename T::A T1;
@@ -65,12 +60,11 @@
CHECK(t2 != T2());
}
-// if variadic macros are supported then "TypePair<int, int>" can be passed directly to the macro (otherwise the commas are a problem)
// currently the string result will be "int_pair" instead of "TypePair<int, int>" because of the way the type stringification works
typedef TypePair<int, int> int_pair;
TYPE_TO_STRING(int_pair);
-TEST_CASE_TEMPLATE("bad stringification of type pair", T, doctest::Types<int_pair>) {
+TEST_CASE_TEMPLATE("bad stringification of type pair", T, int_pair) {
typedef typename T::A T1;
typedef typename T::B T2;
T1 t1 = T1();