From 54f5f2d1703e219dbe9c6505221fd80b0c4655fe Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 13 Apr 2015 21:46:56 +1000 Subject: [PATCH] tap: add expect_nan function --- tap.hpp | 4 ++++ tap.ipp | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/tap.hpp b/tap.hpp index 57eea4ba..c1ddf001 100644 --- a/tap.hpp +++ b/tap.hpp @@ -52,6 +52,10 @@ namespace util { namespace TAP { template void expect_lt (const T&, const U&, const std::string &msg = "lt"); template void expect_le (const T&, const U&, const std::string &msg = "le"); + //--------------------------------------------------------------------- + template void expect_nan (const T&, const std::string &msg = "nan"); + + //--------------------------------------------------------------------- void skip (const std::string &msg); void todo (const std::string &msg); void noop (void); diff --git a/tap.ipp b/tap.ipp index fa16d456..42e797f6 100644 --- a/tap.ipp +++ b/tap.ipp @@ -77,3 +77,13 @@ TAP_TEST(lt, < ) TAP_TEST(le, <=) #undef TAP_TEST + + +//----------------------------------------------------------------------------- +template +void +util::TAP::logger::expect_nan (const T &t, const std::string &msg) +{ + bool(*func)(T) = std::isnan; + expect (func, t, msg); +}