tap: add expect_nan function

This commit is contained in:
Danny Robson 2015-04-13 21:46:56 +10:00
parent e0636a5b5e
commit 54f5f2d170
2 changed files with 14 additions and 0 deletions

View File

@ -52,6 +52,10 @@ namespace util { namespace TAP {
template <typename T, typename U> void expect_lt (const T&, const U&, const std::string &msg = "lt"); template <typename T, typename U> void expect_lt (const T&, const U&, const std::string &msg = "lt");
template <typename T, typename U> void expect_le (const T&, const U&, const std::string &msg = "le"); template <typename T, typename U> void expect_le (const T&, const U&, const std::string &msg = "le");
//---------------------------------------------------------------------
template <typename T> void expect_nan (const T&, const std::string &msg = "nan");
//---------------------------------------------------------------------
void skip (const std::string &msg); void skip (const std::string &msg);
void todo (const std::string &msg); void todo (const std::string &msg);
void noop (void); void noop (void);

10
tap.ipp
View File

@ -77,3 +77,13 @@ TAP_TEST(lt, < )
TAP_TEST(le, <=) TAP_TEST(le, <=)
#undef TAP_TEST #undef TAP_TEST
//-----------------------------------------------------------------------------
template <typename T>
void
util::TAP::logger::expect_nan (const T &t, const std::string &msg)
{
bool(*func)(T) = std::isnan;
expect<const T&> (func, t, msg);
}