]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
vi64ops.c:
authorTomek Mrugalski <tomasz@isc.org>
Sun, 5 Jul 2015 21:58:57 +0000 (23:58 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Sun, 5 Jul 2015 21:58:57 +0000 (23:58 +0200)
  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

13 files changed:
ChangeLog
tests/libntp/run-ssl_init.c
tests/libntp/run-statestr.c
tests/libntp/run-tvtots.c
tests/libntp/run-uglydate.c
tests/libntp/run-vi64ops.c
tests/libntp/run-ymd2yd.c
tests/libntp/ssl_init.c
tests/libntp/statestr.c
tests/libntp/tvtots.c
tests/libntp/uglydate.c
tests/libntp/vi64ops.c
tests/libntp/ymd2yd.c

index ae9da2617aa760c9dc2ffe58a8812c372309f0fb..c9dbca8a477ba4ef91c64883d0d8925a1a026770 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
   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.
index 96d0271ca5d45bffed2f2107bd873ac0fb03b1cc..c224644c63b331e560e5691d3a3b5d803eef1a8d 100644 (file)
@@ -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());
 }
index 6083eee0f558fd3432ad4df5068abe6dd5fcdda3..6679f5fa6fa71778d29262f39a57e0935d50f2d1 100644 (file)
@@ -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());
 }
index 468aae5e09ec6f4a8fd1d36177ac9fea3bbaac9e..f224199f2520e7515f6945c3b508b60efabd3045 100644 (file)
@@ -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());
 }
index 4e67713638cf315cdaaa21d384c214bb752fcbef..620092b67b74c416c4cb8eabcb35c2ef65bbc11c 100644 (file)
@@ -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());
 }
index 8615359d7cdc8efddb8274ac99ccc1bc49951b13..1594692f4c9d721fbba53f02d21980f43e1b3cf9 100644 (file)
@@ -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());
 }
index faf2fcb683c632ad4f0e99de3cf2dd8a26eef60c..42b2aaa58b1e26f6418463bdfdf9e4e4e1bd2b51 100644 (file)
@@ -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());
 }
index 8fbea81785f860672cd5e45834433d80682609c1..4598025cc49ab6a807c541e67f01584278b9a6e3 100644 (file)
@@ -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 */
 }
-
index 5f7babe4537b6c6e8e98cc9b84c81b54afec2413..ef134dd7070d0fbf0552fca4909db25afa6ad16d 100644 (file)
@@ -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));
 }
-
index 6c8345aaaa1b459d46d099c14e35c5a7696837de..953a76cf3695492b81f507500b98af4da7a3b211 100644 (file)
@@ -4,10 +4,12 @@
 #include "timevalops.h"
 
 #include "unity.h"
-#include <math.h>// Required on Solaris for ldexp.
 
+#include <math.h> // 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);
 }
index a8d02d15b910b4eb58a86b516e3da234306ac5b5..fe50b85b807269f039c7cd272487864cdebf4ea5 100644 (file)
@@ -1,7 +1,6 @@
 #include "config.h"
 
 #include "ntp_stdlib.h"
-#include "ntp_calendar.h"
 #include "ntp_fp.h"
 
 #include "unity.h"
index 0dcd935142a8ed3c8fc9ace4dedbc901e8c9389c..3ac47bec2479d863de98fc03f4c6c001a7f10a61 100644 (file)
@@ -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');
 }
-
index 8e0725c13866fbafd007187c10d2de16bd8ee722..65c536ca6d19fbd917bc12459eb1e8ac0d160650 100644 (file)
@@ -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));
 }
-