From: Tomek Mrugalski Date: Sun, 5 Jul 2015 21:58:57 +0000 (+0200) Subject: vi64ops.c: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5bf0210a90660fa0081b941c59d6ad8d72deaa59;p=thirdparty%2Fntp.git vi64ops.c: deleted a comment ymd2yd.c: fixed formatting, deleted empty setUp() and tearDown() ssl_init.c: fixed formatting ChangeLog: updated the changes to vi64ops.c vi64ops.c: fixed formatting (trailing spaces, the order of includes, return type of a function in a new line) ChangeLog: info about tvtots.c ymd2yd.c: removed an include ChangeLog: info about ymd2yd.c uglydate.c: removed an unnecessary include ChangeLog: info about uglydate.c statestr.c: deleted unnecessary empty functions, fixed formatting, removed an unnecessary include ChangeLog: info about vi64ops.c tvtots.c: fixed a bug, fixed formatting Many files: autogenerated bk: 5599a8a1LbLCCs7ZCIggxo3xKXkdTw --- diff --git a/ChangeLog b/ChangeLog index ae9da2617..c9dbca8a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,12 +24,20 @@ fix formatting, cleanup. Tomasz Flendrich * tests/libntp/lfptostr.c remove unnecessary include, add consts, fix formatting. Tomasz Flendrich +* tests/libntp/statestr.c remove empty functions, remove unnecessary include, + fix formatting. Tomasz Flendrich * tests/libntp/modetoa.c fixed formatting. Tomasz Flendrich * tests/libntp/msyslog.c fixed formatting. Tomasz Flendrich * tests/libntp/numtoa.c deleted unnecessary empty functions, fixed formatting. Tomasz Flendrich * tests/libntp/numtohost.c added const, fixed formatting. Tomasz Flendrich * tests/libntp/refnumtoa.c fixed formatting. Tomasz Flendrich +* tests/libntp/ssl_init.c fixed formatting. Tomasz Flendrich +* tests/libntp/tvtots.c fixed a bug, fixed formatting. Tomasz Flendrich +* tests/libntp/uglydate.c removed an unnecessary include. Tomasz Flendrich +* tests/libntp/vi64ops.c removed an unnecessary comment, fixed formatting. +* tests/libntp/ymd3yd.c removed an empty function and an unnecessary include, +fixed formatting. Tomasz Flendrich * sntp/unity/Makefile.am added a missing header. Tomasz Flendrich * sntp/unity/unity_config.h: Distribute it. Harlan Stenn. * sntp/libevent/evconfig-private.h: remove generated filefrom SCM. H.Stenn. diff --git a/tests/libntp/run-ssl_init.c b/tests/libntp/run-ssl_init.c index 96d0271ca..c224644c6 100644 --- a/tests/libntp/run-ssl_init.c +++ b/tests/libntp/run-ssl_init.c @@ -50,11 +50,11 @@ int main(int argc, char *argv[]) progname = argv[0]; Unity.TestFile = "ssl_init.c"; UnityBegin("ssl_init.c"); - RUN_TEST(test_MD5KeyTypeWithoutDigestLength, 19); - RUN_TEST(test_MD5KeyTypeWithDigestLength, 23); - RUN_TEST(test_SHA1KeyTypeWithDigestLength, 32); - RUN_TEST(test_MD5KeyName, 47); - RUN_TEST(test_SHA1KeyName, 51); + RUN_TEST(test_MD5KeyTypeWithoutDigestLength, 20); + RUN_TEST(test_MD5KeyTypeWithDigestLength, 25); + RUN_TEST(test_SHA1KeyTypeWithDigestLength, 35); + RUN_TEST(test_MD5KeyName, 51); + RUN_TEST(test_SHA1KeyName, 57); return (UnityEnd()); } diff --git a/tests/libntp/run-statestr.c b/tests/libntp/run-statestr.c index 6083eee0f..6679f5fa6 100644 --- a/tests/libntp/run-statestr.c +++ b/tests/libntp/run-statestr.c @@ -26,6 +26,7 @@ //=======External Functions This Runner Calls===== extern void setUp(void); extern void tearDown(void); +void resetTest(void); extern void test_PeerRestart(void); extern void test_SysUnspecified(void); extern void test_ClockCodeExists(void); @@ -48,10 +49,10 @@ int main(int argc, char *argv[]) progname = argv[0]; Unity.TestFile = "statestr.c"; UnityBegin("statestr.c"); - RUN_TEST(test_PeerRestart, 20); - RUN_TEST(test_SysUnspecified, 24); - RUN_TEST(test_ClockCodeExists, 29); - RUN_TEST(test_ClockCodeUnknown, 33); + RUN_TEST(test_PeerRestart, 12); + RUN_TEST(test_SysUnspecified, 18); + RUN_TEST(test_ClockCodeExists, 25); + RUN_TEST(test_ClockCodeUnknown, 31); return (UnityEnd()); } diff --git a/tests/libntp/run-tvtots.c b/tests/libntp/run-tvtots.c index 468aae5e0..f224199f2 100644 --- a/tests/libntp/run-tvtots.c +++ b/tests/libntp/run-tvtots.c @@ -26,6 +26,7 @@ //=======External Functions This Runner Calls===== extern void setUp(void); extern void tearDown(void); +void resetTest(void); extern void test_Seconds(void); extern void test_MicrosecondsRounded(void); extern void test_MicrosecondsExact(void); @@ -47,9 +48,9 @@ int main(int argc, char *argv[]) progname = argv[0]; Unity.TestFile = "tvtots.c"; UnityBegin("tvtots.c"); - RUN_TEST(test_Seconds, 10); - RUN_TEST(test_MicrosecondsRounded, 21); - RUN_TEST(test_MicrosecondsExact, 36); + RUN_TEST(test_Seconds, 12); + RUN_TEST(test_MicrosecondsRounded, 25); + RUN_TEST(test_MicrosecondsExact, 43); return (UnityEnd()); } diff --git a/tests/libntp/run-uglydate.c b/tests/libntp/run-uglydate.c index 4e6771363..620092b67 100644 --- a/tests/libntp/run-uglydate.c +++ b/tests/libntp/run-uglydate.c @@ -26,6 +26,7 @@ //=======External Functions This Runner Calls===== extern void setUp(void); extern void tearDown(void); +void resetTest(void); extern void test_ConstantDateTime(void); @@ -45,7 +46,7 @@ int main(int argc, char *argv[]) progname = argv[0]; Unity.TestFile = "uglydate.c"; UnityBegin("uglydate.c"); - RUN_TEST(test_ConstantDateTime, 11); + RUN_TEST(test_ConstantDateTime, 10); return (UnityEnd()); } diff --git a/tests/libntp/run-vi64ops.c b/tests/libntp/run-vi64ops.c index 8615359d7..1594692f4 100644 --- a/tests/libntp/run-vi64ops.c +++ b/tests/libntp/run-vi64ops.c @@ -48,9 +48,9 @@ int main(int argc, char *argv[]) progname = argv[0]; Unity.TestFile = "vi64ops.c"; UnityBegin("vi64ops.c"); - RUN_TEST(test_ParseVUI64_pos, 32); - RUN_TEST(test_ParseVUI64_neg, 46); - RUN_TEST(test_ParseVUI64_case, 59); + RUN_TEST(test_ParseVUI64_pos, 33); + RUN_TEST(test_ParseVUI64_neg, 49); + RUN_TEST(test_ParseVUI64_case, 63); return (UnityEnd()); } diff --git a/tests/libntp/run-ymd2yd.c b/tests/libntp/run-ymd2yd.c index faf2fcb68..42b2aaa58 100644 --- a/tests/libntp/run-ymd2yd.c +++ b/tests/libntp/run-ymd2yd.c @@ -26,6 +26,7 @@ //=======External Functions This Runner Calls===== extern void setUp(void); extern void tearDown(void); +void resetTest(void); extern void test_NonLeapYearFebruary(void); extern void test_NonLeapYearJune(void); extern void test_LeapYearFebruary(void); @@ -48,10 +49,10 @@ int main(int argc, char *argv[]) progname = argv[0]; Unity.TestFile = "ymd2yd.c"; UnityBegin("ymd2yd.c"); - RUN_TEST(test_NonLeapYearFebruary, 17); - RUN_TEST(test_NonLeapYearJune, 21); - RUN_TEST(test_LeapYearFebruary, 26); - RUN_TEST(test_LeapYearDecember, 30); + RUN_TEST(test_NonLeapYearFebruary, 9); + RUN_TEST(test_NonLeapYearJune, 15); + RUN_TEST(test_LeapYearFebruary, 22); + RUN_TEST(test_LeapYearDecember, 28); return (UnityEnd()); } diff --git a/tests/libntp/ssl_init.c b/tests/libntp/ssl_init.c index 8fbea8178..4598025cc 100644 --- a/tests/libntp/ssl_init.c +++ b/tests/libntp/ssl_init.c @@ -16,11 +16,13 @@ static const size_t TEST_SHA1_DIGEST_LENGTH = 20; // keytype_from_text() -void test_MD5KeyTypeWithoutDigestLength(void) { +void +test_MD5KeyTypeWithoutDigestLength(void) { TEST_ASSERT_EQUAL(KEY_TYPE_MD5, keytype_from_text("MD5", NULL)); } -void test_MD5KeyTypeWithDigestLength(void) { +void +test_MD5KeyTypeWithDigestLength(void) { size_t digestLength; size_t expected = TEST_MD5_DIGEST_LENGTH; @@ -29,7 +31,8 @@ void test_MD5KeyTypeWithDigestLength(void) { } -void test_SHA1KeyTypeWithDigestLength(void) { +void +test_SHA1KeyTypeWithDigestLength(void) { #ifdef OPENSSL size_t digestLength; size_t expected = TEST_SHA1_DIGEST_LENGTH; @@ -44,15 +47,17 @@ void test_SHA1KeyTypeWithDigestLength(void) { // keytype_name() -void test_MD5KeyName(void) { +void +test_MD5KeyName(void) { TEST_ASSERT_EQUAL_STRING("MD5", keytype_name(KEY_TYPE_MD5)); } -void test_SHA1KeyName(void) { + +void +test_SHA1KeyName(void) { #ifdef OPENSSL TEST_ASSERT_EQUAL_STRING("SHA", keytype_name(NID_sha)); #else TEST_IGNORE_MESSAGE("Skipping because OPENSSL isn't defined"); #endif /* OPENSSL */ } - diff --git a/tests/libntp/statestr.c b/tests/libntp/statestr.c index 5f7babe45..ef134dd70 100644 --- a/tests/libntp/statestr.c +++ b/tests/libntp/statestr.c @@ -1,36 +1,33 @@ #include "config.h" #include "ntp_stdlib.h" -#include "ntp_calendar.h" -#include "ntp.h" // Needed for MAX_MAC_LEN used in ntp_control.h +#include "ntp.h" // needed for MAX_MAC_LEN used in ntp_control.h #include "ntp_control.h" #include "unity.h" -void setUp(void) -{ -} - -void tearDown(void) -{ -} - // eventstr() -void test_PeerRestart(void) { +void +test_PeerRestart(void) { TEST_ASSERT_EQUAL_STRING("restart", eventstr(PEVNT_RESTART)); } -void test_SysUnspecified(void) { + +void +test_SysUnspecified(void) { TEST_ASSERT_EQUAL_STRING("unspecified", eventstr(EVNT_UNSPEC)); } + // ceventstr() -void test_ClockCodeExists(void) { +void +test_ClockCodeExists(void) { TEST_ASSERT_EQUAL_STRING("clk_unspec", ceventstr(CTL_CLK_OKAY)); } -void test_ClockCodeUnknown(void) { + +void +test_ClockCodeUnknown(void) { TEST_ASSERT_EQUAL_STRING("clk_-1", ceventstr(-1)); } - diff --git a/tests/libntp/tvtots.c b/tests/libntp/tvtots.c index 6c8345aaa..953a76cf3 100644 --- a/tests/libntp/tvtots.c +++ b/tests/libntp/tvtots.c @@ -4,10 +4,12 @@ #include "timevalops.h" #include "unity.h" -#include // Required on Solaris for ldexp. +#include // Required on Solaris for ldexp. -void test_Seconds(void) + +void +test_Seconds(void) { struct timeval input = {500, 0}; // 500.0 s l_fp expected = {500, 0}; @@ -18,7 +20,9 @@ void test_Seconds(void) TEST_ASSERT_TRUE(IsEqual(expected, actual)); } -void test_MicrosecondsRounded(void) + +void +test_MicrosecondsRounded(void) { /* 0.0005 can not be represented exact in a l_fp structure. * It would equal to 2147483,648. This means that @@ -30,10 +34,13 @@ void test_MicrosecondsRounded(void) l_fp actual; TVTOTS(&input, &actual); + TEST_ASSERT_TRUE(IsEqual(expected, actual)); } -void test_MicrosecondsExact(void) + +void +test_MicrosecondsExact(void) { // 0.5 can be represented exact in both l_fp and timeval. const struct timeval input = {10, 500000}; // 0.5 exact @@ -50,5 +57,5 @@ void test_MicrosecondsExact(void) M_LFPTOD(0, actual.l_uf, actualDouble); // The error should be less than 0.5 us - TEST_ASSERT_DOUBLE_WITHIN(0000005, expectedDouble, actualDouble); + TEST_ASSERT_DOUBLE_WITHIN(0.0000005, expectedDouble, actualDouble); } diff --git a/tests/libntp/uglydate.c b/tests/libntp/uglydate.c index a8d02d15b..fe50b85b8 100644 --- a/tests/libntp/uglydate.c +++ b/tests/libntp/uglydate.c @@ -1,7 +1,6 @@ #include "config.h" #include "ntp_stdlib.h" -#include "ntp_calendar.h" #include "ntp_fp.h" #include "unity.h" diff --git a/tests/libntp/vi64ops.c b/tests/libntp/vi64ops.c index 0dcd93514..3ac47bec2 100644 --- a/tests/libntp/vi64ops.c +++ b/tests/libntp/vi64ops.c @@ -1,35 +1,36 @@ #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) { +// 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); + printf( "%x.", expected.D_s.hi); + printf("%x", expected.D_s.lo); printf(" but was "); - printf("%x.",actual.D_s.hi); - printf("%x\n",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); - printf("%d",expected.D_s.lo); + printf("%d", expected.D_s.lo); printf(" but was "); - printf("%d",actual.D_s.lo); - printf("%d",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) { +void +test_ParseVUI64_pos(void) { vint64 act, exp; const char *sp; char *ep; @@ -43,7 +44,9 @@ void test_ParseVUI64_pos(void) { TEST_ASSERT_EQUAL(*ep, 'x'); } -void test_ParseVUI64_neg(void) { + +void +test_ParseVUI64_neg(void) { vint64 act, exp; const char *sp; char *ep; @@ -56,7 +59,8 @@ void test_ParseVUI64_neg(void) { TEST_ASSERT_EQUAL(*ep, 'x'); } -void test_ParseVUI64_case(void) { +void +test_ParseVUI64_case(void) { vint64 act, exp; const char *sp; char *ep; @@ -68,4 +72,3 @@ void test_ParseVUI64_case(void) { TEST_ASSERT_TRUE(IsEqual(exp, act)); TEST_ASSERT_EQUAL(*ep, '\0'); } - diff --git a/tests/libntp/ymd2yd.c b/tests/libntp/ymd2yd.c index 8e0725c13..65c536ca6 100644 --- a/tests/libntp/ymd2yd.c +++ b/tests/libntp/ymd2yd.c @@ -1,35 +1,32 @@ #include "config.h" #include "ntp_stdlib.h" -#include "ntp_calendar.h" #include "unity.h" -void setUp(void) -{ -} -void tearDown(void) -{ +void +test_NonLeapYearFebruary(void) { + TEST_ASSERT_EQUAL(31 + 20, ymd2yd(2010, 2, 20)); //2010-02-20 } -void test_NonLeapYearFebruary (void) { - TEST_ASSERT_EQUAL(31+20, ymd2yd(2010,2,20)); //2010-02-20 -} - -void test_NonLeapYearJune (void) { +void +test_NonLeapYearJune(void) { int expected = 31+28+31+30+31+18; // 18 June non-leap year - TEST_ASSERT_EQUAL(expected, ymd2yd(2011,6,18)); + TEST_ASSERT_EQUAL(expected, ymd2yd(2011, 6, 18)); } -void test_LeapYearFebruary (void) { - TEST_ASSERT_EQUAL(31+20, ymd2yd(2012,2,20)); //2012-02-20 (leap year) + +void +test_LeapYearFebruary(void) { + TEST_ASSERT_EQUAL(31 + 20, ymd2yd(2012, 2, 20)); //2012-02-20 (leap year) } -void test_LeapYearDecember (void) { + +void +test_LeapYearDecember(void) { // 2012-12-31 int expected = 31+29+31+30+31+30+31+31+30+31+30+31; - TEST_ASSERT_EQUAL(expected, ymd2yd(2012,12,31)); + TEST_ASSERT_EQUAL(expected, ymd2yd(2012, 12, 31)); } -