the Compartmented Robust Posix C++ Unit Test system | hosted by |
---|
Select a predicate based on the parameter types.
Used in: An ASSERT_PRED(pred, ...)
,
often together with
crpcut::abs_diff,
crpcut::relative_diff,
crpcut::ulps_diff or
crpcut::regex.
crpcut::match
<matcher>(...)
can create a predicate by instantiating an object of type depending on
the type of the parameters.
For example,
crpcut::match
<crpcut::abs_diff>(
)
instantiates an object of type
crpcut::abs_diff::type<double>, whereas
crpcut::1.0
match
<crpcut::abs_diff>(
)
instantiates an object of type
crpcut::abs_diff::type<float>.
1.0f
By default,
crpcut::match
<matcher
>
instantiates an object of type matcher
,
but this can be changed by specializing the template
crpcut::match_traits. For example,
crpcut::abs_diff uses the specialization
namespace crpcut { template <typename T> struct match_traits<abs_diff, T> { typedef typename abs_diff::template type<T> type; }; }
where, of course, crpcut::abs_diff::type<T> is the actual predicate used in comparisons.
match_traits can be specialized with up to 10
template parameters.