]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/tests/libntp/g_lfptest.h
Fix a regression with SA-15:24 patch that prevented NIS from
[FreeBSD/releng/10.2.git] / contrib / ntp / tests / libntp / g_lfptest.h
1 #ifndef NTP_TESTS_LFPTEST_H
2 #define NTP_TESTS_LFPTEST_H
3
4 #include "g_libntptest.h"
5
6 extern "C" {
7 #include "ntp_fp.h"
8 };
9
10 class lfptest : public libntptest {
11 protected:
12         ::testing::AssertionResult IsEqual(const l_fp &expected, const l_fp &actual) {
13                 if (L_ISEQU(&expected, &actual)) {
14                         return ::testing::AssertionSuccess();
15                 } else {
16                         return ::testing::AssertionFailure()
17                                 << " expected: " << lfptoa(&expected, FRACTION_PREC)
18                                 << " (" << expected.l_ui << "." << expected.l_uf << ")"
19                                 << " but was: " << lfptoa(&actual, FRACTION_PREC)
20                                 << " (" << actual.l_ui << "." << actual.l_uf << ")";
21                 }
22         }
23
24         static const int32 HALF = -2147483647L - 1L;
25         static const int32 HALF_PROMILLE_UP = 2147484; // slightly more than 0.0005
26         static const int32 HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
27         static const int32 QUARTER = 1073741824L;
28         static const int32 QUARTER_PROMILLE_APPRX = 1073742L;
29 };
30
31 #endif
32 /* NTP_TESTS_LFPTEST_H */