the Compartmented Robust Posix C++ Unit Test system |
|
---|
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.
Note | |
---|---|
If you use GCC version 4.3 or higher, and compile your test sources with -std=c++0x, there is no limit to the number of parameters, otherwise there is a maximum limit of 9 parameters. |