summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/tests/libntp/g_timestructs.cpp
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2015-10-26 11:35:40 +0000
committerglebius <glebius@FreeBSD.org>2015-10-26 11:35:40 +0000
commitc62812877398840dae0ba74b03e9e6a43cc56fc5 (patch)
tree304551aa93f09787d4f56a966c6409faf1b1bcb0 /contrib/ntp/tests/libntp/g_timestructs.cpp
parent9e809ce638c9be9ffb800ced1b91c0e8997f4c9e (diff)
downloadFreeBSD-src-c62812877398840dae0ba74b03e9e6a43cc56fc5.zip
FreeBSD-src-c62812877398840dae0ba74b03e9e6a43cc56fc5.tar.gz
Upgrade NTP to 4.2.8p4.
Security: FreeBSD-SA-15:25.ntp Security: CVE-2015-7871 Security: CVE-2015-7855 Security: CVE-2015-7854 Security: CVE-2015-7853 Security: CVE-2015-7852 Security: CVE-2015-7851 Security: CVE-2015-7850 Security: CVE-2015-7849 Security: CVE-2015-7848 Security: CVE-2015-7701 Security: CVE-2015-7703 Security: CVE-2015-7704, CVE-2015-7705 Security: CVE-2015-7691, CVE-2015-7692, CVE-2015-7702
Diffstat (limited to 'contrib/ntp/tests/libntp/g_timestructs.cpp')
-rw-r--r--contrib/ntp/tests/libntp/g_timestructs.cpp156
1 files changed, 0 insertions, 156 deletions
diff --git a/contrib/ntp/tests/libntp/g_timestructs.cpp b/contrib/ntp/tests/libntp/g_timestructs.cpp
deleted file mode 100644
index 15b5ec1..0000000
--- a/contrib/ntp/tests/libntp/g_timestructs.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * timestructs.cpp -- test bed adaptors for time structs.
- *
- * Written by Juergen Perlinger (perlinger@ntp.org) for the NTP project.
- * The contents of 'html/copyright.html' apply.
- */
-#include "g_libntptest.h"
-#include "g_timestructs.h"
-
-extern "C" {
-#include "timetoa.h"
-#include "timevalops.h"
-#include "timespecops.h"
-}
-
-namespace timeStruct {
-
-std::ostream&
-operator << (std::ostream& os, const timeStruct::l_fp_wrap& val)
-{
- // raw data formatting
- os << "0x" << std::hex << val.V.l_ui << ':'
- << std::setfill('0') << std::setw(8) << val.V.l_uf
- << std::dec;
- // human-readable format
- os << '[' << lfptoa(&val.V, 10) << ']';
- return os;
-}
-
-std::ostream&
-operator << (std::ostream& os, const timeStruct::timeval_wrap& val)
-{
- // raw data formatting
- os << val.V.tv_sec << ':' << val.V.tv_usec;
- // human-readable format
- os << '['
- << format_time_fraction(val.V.tv_sec, val.V.tv_usec, 6)
- << ']';
- return os;
-}
-
-std::ostream&
-operator << (std::ostream& os, const timeStruct::timespec_wrap& val)
-{
- // raw data formatting
- os << val.V.tv_sec << ':' << val.V.tv_nsec;
- // human-readable format
- os << '['
- << format_time_fraction(val.V.tv_sec, val.V.tv_nsec, 9)
- << ']';
- return os;
-}
-
-// Implementation of the l_fp closeness predicate
-
-AssertFpClose::AssertFpClose(
- u_int32 hi,
- u_int32 lo
- )
-{
- limit.l_ui = hi;
- limit.l_uf = lo;
-}
-
-::testing::AssertionResult
-AssertFpClose::operator()(
- const char* m_expr,
- const char* n_expr,
- const l_fp & m,
- const l_fp & n
- )
-{
- l_fp diff;
-
- if (L_ISGEQ(&m, &n)) {
- diff = m;
- L_SUB(&diff, &n);
- } else {
- diff = n;
- L_SUB(&diff, &m);
- }
- if (L_ISGEQ(&limit, &diff))
- return ::testing::AssertionSuccess();
-
- return ::testing::AssertionFailure()
- << m_expr << " which is " << l_fp_wrap(m)
- << "\nand\n"
- << n_expr << " which is " << l_fp_wrap(n)
- << "\nare not close; diff=" << l_fp_wrap(diff);
-}
-
-// Implementation of the timeval closeness predicate
-
-AssertTimevalClose::AssertTimevalClose(
- time_t hi,
- int32 lo
- )
-{
- limit.tv_sec = hi;
- limit.tv_usec = lo;
-}
-
-::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);
-}
-
-// Implementation of the timespec closeness predicate
-
-AssertTimespecClose::AssertTimespecClose(
- time_t hi,
- int32 lo
- )
-{
- limit.tv_sec = hi;
- limit.tv_nsec = lo;
-}
-
-::testing::AssertionResult
-AssertTimespecClose::operator()(
- const char* m_expr,
- const char* n_expr,
- const struct timespec & m,
- const struct timespec & n
- )
-{
- struct timespec diff;
-
- diff = abs_tspec(sub_tspec(m, n));
- if (cmp_tspec(limit, diff) >= 0)
- return ::testing::AssertionSuccess();
-
- return ::testing::AssertionFailure()
- << m_expr << " which is " << timespec_wrap(m)
- << "\nand\n"
- << n_expr << " which is " << timespec_wrap(n)
- << "\nare not close; diff=" << timespec_wrap(diff);
-}
-
-} // namespace timeStruct
OpenPOWER on IntegriCloud