Commit 1ca3d015 by Corentin Wallez

Simplify the implementation of ANGLE_INSTANTIATE_TEST

I mistakenly submitted a refactor with +2 but not +1 so a comment wasn't addressed, hopefully fixes it. BUG=angleproject:892 Change-Id: I096c2424449be196dfa949cc6ef662b766036330 Reviewed-on: https://chromium-review.googlesource.com/272905Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 7e7e68de
......@@ -19,7 +19,7 @@ namespace angle
// internally it T::getRenderer() const that should be implemented for test
// parameter types.
template <typename T>
inline std::vector<T> FilterTestParams(const T *params, size_t numParams)
std::vector<T> FilterTestParams(const T *params, size_t numParams)
{
std::vector<T> filtered;
......@@ -59,21 +59,10 @@ inline std::vector<T> FilterTestParams(const T *params, size_t numParams)
return filtered;
}
namespace detail {
// Used with decltype to get the type of the first argument.
template <typename T, typename ... Args>
T ReturnFirst(T first, Args...)
{
return first;
}
} // namespace detail
// Instantiate the test once for each extra argument. The types of all the
// arguments must match, and getRenderer must be implemented for that type.
#define ANGLE_INSTANTIATE_TEST(testName, ...) \
const decltype(::angle::detail::ReturnFirst(__VA_ARGS__)) testName##params[] = {__VA_ARGS__}; \
#define ANGLE_INSTANTIATE_TEST(testName, firstParam, ...) \
const decltype(firstParam) testName##params[] = { firstParam, ##__VA_ARGS__ }; \
INSTANTIATE_TEST_CASE_P(, testName, testing::ValuesIn(::angle::FilterTestParams(testName##params, ArraySize(testName##params))));
} // namespace angle
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment