diff options
Diffstat (limited to 'contrib/ntp/tests/libntp/vi64ops.c')
-rw-r--r-- | contrib/ntp/tests/libntp/vi64ops.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/contrib/ntp/tests/libntp/vi64ops.c b/contrib/ntp/tests/libntp/vi64ops.c index af7dd1b..843c0a3 100644 --- a/contrib/ntp/tests/libntp/vi64ops.c +++ b/contrib/ntp/tests/libntp/vi64ops.c @@ -1,36 +1,42 @@ #include "config.h" #include "ntp_stdlib.h" +#include "vint64ops.h" #include "unity.h" -#include "vint64ops.h" -//technically bool -//int IsEqual(const vint64 &expected, const vint64 &actual) { -int IsEqual(const vint64 expected, const vint64 actual) { +int IsEqual(const vint64 expected, const vint64 actual); +void test_ParseVUI64_pos(void); +void test_ParseVUI64_neg(void); +void test_ParseVUI64_case(void); + + +// technically bool +int +IsEqual(const vint64 expected, const vint64 actual) { if (0 == memcmp(&expected, &actual, sizeof(vint64))) { - printf( "%x.", expected.D_s.hi); //<< std::hex << expected.D_s.hi << '.' - printf("%x",expected.D_s.lo);//<< std::hex << expected.D_s.lo + printf( "%x.", expected.D_s.hi); + printf("%x", expected.D_s.lo); printf(" but was "); - printf("%x.",actual.D_s.hi); //<< std::hex << actual.D_s.hi << '.' - printf("%x\n",actual.D_s.lo); //<< std::hex << actual.D_s.lo; + printf("%x.", actual.D_s.hi); + printf("%x\n", actual.D_s.lo); return TRUE; } else { - printf("expected: "); - printf( "%d.", expected.D_s.hi); //<< std::hex << expected.D_s.hi << '.' - printf("%d",expected.D_s.lo);//<< std::hex << expected.D_s.lo + printf( "%d.", expected.D_s.hi); + printf("%d", expected.D_s.lo); printf(" but was "); - printf("%d",actual.D_s.lo); //<< std::hex << actual.D_s.hi << '.' - printf("%d",actual.D_s.lo); //<< std::hex << actual.D_s.lo; + printf("%d", actual.D_s.lo); + printf("%d", actual.D_s.lo); return FALSE; } } // ---------------------------------------------------------------------- // test number parser -void test_ParseVUI64_pos() { +void +test_ParseVUI64_pos(void) { vint64 act, exp; const char *sp; char *ep; @@ -44,7 +50,9 @@ void test_ParseVUI64_pos() { TEST_ASSERT_EQUAL(*ep, 'x'); } -void test_ParseVUI64_neg() { + +void +test_ParseVUI64_neg(void) { vint64 act, exp; const char *sp; char *ep; @@ -57,7 +65,8 @@ void test_ParseVUI64_neg() { TEST_ASSERT_EQUAL(*ep, 'x'); } -void test_ParseVUI64_case() { +void +test_ParseVUI64_case(void) { vint64 act, exp; const char *sp; char *ep; @@ -69,4 +78,3 @@ void test_ParseVUI64_case() { TEST_ASSERT_TRUE(IsEqual(exp, act)); TEST_ASSERT_EQUAL(*ep, '\0'); } - |