bool AssertTimevalClose(const struct timeval m, const struct timeval n, const struct timeval limit) { struct timeval diff; diff = abs_tval(sub_tval(m, n)); if (cmp_tval(limit, diff) >= 0) return TRUE; else { printf("m_expr which is %ld.%lu \nand\nn_expr which is %ld.%lu\nare not close; diff=%ld.%luusec\n", m.tv_sec, m.tv_usec, n.tv_sec, n.tv_usec, diff.tv_sec, diff.tv_usec); //I don't have variables m_expr and n_expr in unity, those are command line arguments which only getst has!!! return FALSE; } }
bool AssertTimevalClose(const struct timeval m, const struct timeval n, const struct timeval limit) { struct timeval diff; diff = abs_tval(sub_tval(m, n)); if (cmp_tval(limit, diff) >= 0) return TRUE; else { //printf(""); //<< m_expr << " which is " << timeval_wrap(m) //<< "\nand\n" //<< n_expr << " which is " << timeval_wrap(n) //<< "\nare not close; diff=" << timeval_wrap(diff); return FALSE; } }
::testing::AssertionResult AssertTimevalClose::operator()( const char* m_expr, const char* n_expr, const struct timeval & m, const struct timeval & n ) { struct timeval diff; diff = abs_tval(sub_tval(m, n)); if (cmp_tval(limit, diff) >= 0) return ::testing::AssertionSuccess(); return ::testing::AssertionFailure() << m_expr << " which is " << timeval_wrap(m) << "\nand\n" << n_expr << " which is " << timeval_wrap(n) << "\nare not close; diff=" << timeval_wrap(diff); }