summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/tests/libntp/buftvtots.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/tests/libntp/buftvtots.c')
-rw-r--r--contrib/ntp/tests/libntp/buftvtots.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/contrib/ntp/tests/libntp/buftvtots.c b/contrib/ntp/tests/libntp/buftvtots.c
index edeedf6..efde009 100644
--- a/contrib/ntp/tests/libntp/buftvtots.c
+++ b/contrib/ntp/tests/libntp/buftvtots.c
@@ -8,15 +8,20 @@
#include "unity.h"
-// Required for Solaris.
+/* Required for Solaris. */
#include <math.h>
+void test_ZeroBuffer(void);
+void test_IntegerAndFractionalBuffer(void);
+void test_IllegalMicroseconds(void);
+void test_AlwaysFalseOnWindows(void);
-void test_ZeroBuffer() {
+void
+test_ZeroBuffer(void) {
#ifndef SYS_WINNT
const struct timeval input = {0, 0};
- const l_fp expected = {0 + JAN_1970, 0};
+ const l_fp expected = {{0 + JAN_1970}, 0};
l_fp actual;
@@ -27,32 +32,33 @@ void test_ZeroBuffer() {
#endif
}
-void test_IntegerAndFractionalBuffer() {
+void
+test_IntegerAndFractionalBuffer(void) {
#ifndef SYS_WINNT
- const struct timeval input = {5, 500000}; // 5.5
- const l_fp expected = {5 + JAN_1970, HALF};
-
+ const struct timeval input = {5, 500000}; /* 5.5 */
+ const l_fp expected = {{5 + JAN_1970}, HALF};
+ double expectedDouble, actualDouble;
l_fp actual;
TEST_ASSERT_TRUE(buftvtots((const char*)(&input), &actual));
- // Compare the fractional part with an absolute error given.
+ /* Compare the fractional part with an absolute error given. */
TEST_ASSERT_EQUAL(expected.l_ui, actual.l_ui);
- double expectedDouble, actualDouble;
M_LFPTOD(0, expected.l_uf, expectedDouble);
M_LFPTOD(0, actual.l_uf, actualDouble);
- // The error should be less than 0.5 us
- TEST_ASSERT_DOUBLE_WITHIN(0.0000005,expectedDouble,actualDouble); //delta,epected,actual //_EXPECT_NEAR(expectedDouble, actualDouble, 0.0000005);
+ /* The error should be less than 0.5 us */
+ TEST_ASSERT_DOUBLE_WITHIN(0.0000005, expectedDouble, actualDouble);
#else
TEST_IGNORE_MESSAGE("Test only for Windows, skipping...");
#endif
}
-void test_IllegalMicroseconds() {
+void
+test_IllegalMicroseconds(void) {
#ifndef SYS_WINNT
- const struct timeval input = {0, 1100000}; // > 999 999 microseconds.
+ const struct timeval input = {0, 1100000}; /* > 999 999 microseconds. */
l_fp actual;
@@ -63,7 +69,8 @@ void test_IllegalMicroseconds() {
}
-void test_AlwaysFalseOnWindows() {
+void
+test_AlwaysFalseOnWindows(void) {
#ifdef SYS_WINNT
/*
* Under Windows, buftvtots will just return
OpenPOWER on IntegriCloud