<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
  img {
    max-width: 100%;
    height: auto;
  }
  p.details {
    font-style:italic;
    color:#777
  }
  .footer p {
    font-size:small;
    color:#777
  }
  pre.commit-message {
    white-space: pre-wrap;
  }
  .file-stats a {
    text-decoration: none;
  }
  .file-stats .new-file {
    color: #090;
  }
  .file-stats .deleted-file {
    color: #B00;
  }
</style>
<body>
<div class='content'>
<h3>Amar Takhar pushed to branch master at <a href="https://gitlab.com/NTPsec/ntpsec">NTPsec / ntpsec</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/605fde796486983e0fa6a1f17b02f52a341ba4f4">605fde79</a></strong>
<div>
<span>by Amar Takhar</span>
<i>at 2015-11-24T13:24:27Z</i>
</div>
<pre class='commit-message'>Convert vi64ops.c</pre>
</li>
<li>
<strong><a href="https://gitlab.com/NTPsec/ntpsec/commit/bce7a4b7ddbd1998c367be12f19a5d73d27cb90e">bce7a4b7</a></strong>
<div>
<span>by Amar Takhar</span>
<i>at 2015-11-24T13:24:27Z</i>
</div>
<pre class='commit-message'>Convert calyearstart.c and do some header cleanup.

  * Move time functions to caltime.(c|h)
  * Rename TEST_LIBNTP_SSL to TEST_LIBNTP</pre>
</li>
</ul>
<h4>8 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
<span class='new-file'>
+
tests/common/caltime.c
</span>
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
<span class='new-file'>
+
tests/common/caltime.h
</span>
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
tests/common/tests_main.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
<span class='deleted-file'>

tests/libntp/cal.h
</span>
</a>
</li>
<li class='file-stats'>
<a href='#diff-4'>
tests/libntp/calyearstart.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-5'>
tests/libntp/libntptest.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-6'>
tests/libntp/vi64ops.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-7'>
tests/wscript
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/92ecea22056735e1b962793368966e2286249f3b...bce7a4b7ddbd1998c367be12f19a5d73d27cb90e#diff-0'>
<strong>
tests/common/caltime.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- /dev/null
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/common/caltime.c
</span><span style="color: #aaaaaa">@@ -0,0 +1,25 @@
</span><span style="color: #000000;background-color: #ddffdd">+#include "config.h"
+#include <time.h>
+
+#include "caltime.h"
+#include "ntp_stdlib.h"
+#include "ntp_calendar.h"
+
+u_long current_time = 4;
+time_t nowtime = 0;
+
+time_t timefunc(time_t *ptr) {
+       if (ptr) {
+               *ptr = nowtime;
+       }
+       return nowtime;
+}
+
+void settime(int y, int m, int d, int H, int M, int S) {
+
+       time_t days = ntpcal_edate_to_eradays(y-1, m-1, d-1) + (1 - DAY_UNIX_STARTS);
+       time_t secs = ntpcal_etime_to_seconds(H, M, S);
+
+       nowtime = days * SECSPERDAY + secs;
+}
+
</span></code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/92ecea22056735e1b962793368966e2286249f3b...bce7a4b7ddbd1998c367be12f19a5d73d27cb90e#diff-1'>
<strong>
tests/common/caltime.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- /dev/null
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/common/caltime.h
</span><span style="color: #aaaaaa">@@ -0,0 +1,3 @@
</span><span style="color: #000000;background-color: #ddffdd">+time_t timefunc(time_t*);
+void   settime(int y, int m, int d, int H, int M, int S);
+
</span></code></pre>

<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/92ecea22056735e1b962793368966e2286249f3b...bce7a4b7ddbd1998c367be12f19a5d73d27cb90e#diff-2'>
<strong>
tests/common/tests_main.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/common/tests_main.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/common/tests_main.c
</span><span style="color: #aaaaaa">@@ -1,6 +1,7 @@
</span><span style="color: #000000;background-color: #ffdddd">-#include "tests_main.h"
</span> 
<span style="color: #000000;background-color: #ffdddd">-const char *progname = "ntpdigtest";
</span><span style="color: #000000;background-color: #ddffdd">+
+#include "tests_main.h"
+const char *progname = "ntpsectest";
</span> 
 static const char** args_argv;
 static int args_argc;
<span style="color: #aaaaaa">@@ -35,13 +36,13 @@ static void RunAllTests(void)
</span>   RUN_TEST_GROUP(packetHandling);
 #endif
 
<span style="color: #000000;background-color: #ffdddd">-#ifdef TEST_LIBNTP_SSL
</span><span style="color: #000000;background-color: #ddffdd">+#ifdef TEST_LIBNTP
</span> //        RUN_TEST_GROUP(a_md5encrypt);
 //     RUN_TEST_GROUP(authkeys);
 //     RUN_TEST_GROUP(calendar);
 //     RUN_TEST_GROUP(caljulian);
 //     RUN_TEST_GROUP(caltontp);
<span style="color: #000000;background-color: #ffdddd">-//      RUN_TEST_GROUP(calyearstart);
</span><span style="color: #000000;background-color: #ddffdd">+   RUN_TEST_GROUP(calyearstart);
</span> //        RUN_TEST_GROUP(clocktime);
 //     RUN_TEST_GROUP(decodenetnum);
 //     RUN_TEST_GROUP(hextolfp);
<span style="color: #aaaaaa">@@ -66,12 +67,13 @@ static void RunAllTests(void)
</span> //        RUN_TEST_GROUP(timevalops);
        RUN_TEST_GROUP(tstotv);
        RUN_TEST_GROUP(tvtots);
<span style="color: #000000;background-color: #ffdddd">-//      RUN_TEST_GROUP(vi64);
</span><span style="color: #000000;background-color: #ddffdd">+   RUN_TEST_GROUP(vi64ops);
</span> //        RUN_TEST_GROUP(ymd2yd);
 #endif
 
 }
 
<span style="color: #000000;background-color: #ddffdd">+
</span> int main(int argc, const char * argv[]) {
 
        init_lib();
</code></pre>

<br>
</li>
<li id='diff-3'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/92ecea22056735e1b962793368966e2286249f3b...bce7a4b7ddbd1998c367be12f19a5d73d27cb90e#diff-3'>
<strong>
tests/libntp/cal.h
</strong>
deleted
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/libntp/cal.h
</span><span style="color: #000000;background-color: #ddffdd">+++ /dev/null
</span><span style="color: #aaaaaa">@@ -1,3 +0,0 @@
</span><span style="color: #000000;background-color: #ffdddd">-static time_t timefunc(time_t*);
-static void   settime(int y, int m, int d, int H, int M, int S);
-
</span></code></pre>

<br>
</li>
<li id='diff-4'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/92ecea22056735e1b962793368966e2286249f3b...bce7a4b7ddbd1998c367be12f19a5d73d27cb90e#diff-4'>
<strong>
tests/libntp/calyearstart.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/libntp/calyearstart.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/libntp/calyearstart.c
</span><span style="color: #aaaaaa">@@ -1,54 +1,45 @@
</span><span style="color: #000000;background-color: #ffdddd">-extern "C" {
</span><span style="color: #000000;background-color: #ddffdd">+#include "config.h"
+
</span> #include "unity.h"
 #include "unity_fixture.h"
<span style="color: #000000;background-color: #ffdddd">-}
-
-TEST_GROUP(calyearstart);
-
-TEST_SETUP(calyearstart) {}
</span> 
<span style="color: #000000;background-color: #ffdddd">-TEST_TEAR_DOWN(calyearstart) {}
</span><span style="color: #000000;background-color: #ddffdd">+#include "ntp_stdlib.h"
+#include "ntp_calendar.h"
+#include "caltime.h"
</span> 
<span style="color: #000000;background-color: #ffdddd">-#include "libntptest.h"
-#include "cal.h"
</span><span style="color: #000000;background-color: #ddffdd">+static time_t nowtime;
</span> 
<span style="color: #000000;background-color: #ffdddd">-class calyearstartTest : public libntptest {
-protected:
-       virtual void SetUp();
-       virtual void TearDown();
-};
</span><span style="color: #000000;background-color: #ddffdd">+TEST_GROUP(calyearstart);
</span> 
<span style="color: #000000;background-color: #ffdddd">-void calyearstartTest::SetUp()
-{
</span><span style="color: #000000;background-color: #ddffdd">+TEST_SETUP(calyearstart) {
</span>     ntpcal_set_timefunc(timefunc);
     settime(1970, 1, 1, 0, 0, 0);
 }
 
<span style="color: #000000;background-color: #ffdddd">-void calyearstartTest::TearDown()
-{
</span><span style="color: #000000;background-color: #ddffdd">+TEST_TEAR_DOWN(calyearstart) {
</span>     ntpcal_set_timefunc(NULL);
 }
 
 
 TEST(calyearstart, NoWrapInDateRange) {
<span style="color: #000000;background-color: #ffdddd">-        const u_int32 input = 3486372600UL; // 2010-06-24 12:50:00.
-       const u_int32 expected = 3471292800UL; // 2010-01-01 00:00:00
</span><span style="color: #000000;background-color: #ddffdd">+   const u_int32_t input = 3486372600UL; // 2010-06-24 12:50:00.
+       const u_int32_t expected = 3471292800UL; // 2010-01-01 00:00:00
</span> 
        TEST_ASSERT_EQUAL(expected, calyearstart(input, &nowtime));
        TEST_ASSERT_EQUAL(expected, calyearstart(input, NULL));
 }
 
 TEST(calyearstart, NoWrapInDateRangeLeapYear) {
<span style="color: #000000;background-color: #ffdddd">-        const u_int32 input = 3549528000UL; // 2012-06-24 12:00:00
-       const u_int32 expected = 3534364800UL; // 2012-01-01 00:00:00
</span><span style="color: #000000;background-color: #ddffdd">+   const u_int32_t input = 3549528000UL; // 2012-06-24 12:00:00
+       const u_int32_t expected = 3534364800UL; // 2012-01-01 00:00:00
</span> 
        TEST_ASSERT_EQUAL(expected, calyearstart(input, &nowtime));
        TEST_ASSERT_EQUAL(expected, calyearstart(input, NULL));
 }
 
 TEST(calyearstart, WrapInDateRange) {
<span style="color: #000000;background-color: #ffdddd">-        const u_int32 input = 19904UL; // 2036-02-07 12:00:00
-       const u_int32 expected = 4291747200UL; // 2036-01-01 00:00:00
</span><span style="color: #000000;background-color: #ddffdd">+   const u_int32_t input = 19904UL; // 2036-02-07 12:00:00
+       const u_int32_t expected = 4291747200UL; // 2036-01-01 00:00:00
</span> 
        TEST_ASSERT_EQUAL(expected, calyearstart(input, &nowtime));
        TEST_ASSERT_EQUAL(expected, calyearstart(input, NULL));
</code></pre>

<br>
</li>
<li id='diff-5'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/92ecea22056735e1b962793368966e2286249f3b...bce7a4b7ddbd1998c367be12f19a5d73d27cb90e#diff-5'>
<strong>
tests/libntp/libntptest.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/libntp/libntptest.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/libntp/libntptest.h
</span><span style="color: #aaaaaa">@@ -1,6 +1,4 @@
</span> #include "tests_main.h"
 
 #include "ntp_stdlib.h"
<span style="color: #000000;background-color: #ffdddd">-#include "ntp_calendar.h"
</span> 
<span style="color: #000000;background-color: #ffdddd">-static time_t nowtime;
</span></code></pre>

<br>
</li>
<li id='diff-6'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/92ecea22056735e1b962793368966e2286249f3b...bce7a4b7ddbd1998c367be12f19a5d73d27cb90e#diff-6'>
<strong>
tests/libntp/vi64ops.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/libntp/vi64ops.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/libntp/vi64ops.c
</span><span style="color: #aaaaaa">@@ -1,7 +1,5 @@
</span><span style="color: #000000;background-color: #ffdddd">-extern "C" {
</span> #include "unity.h"
 #include "unity_fixture.h"
<span style="color: #000000;background-color: #ffdddd">-}
</span> 
 TEST_GROUP(vi64ops);
 
<span style="color: #aaaaaa">@@ -11,30 +9,26 @@ TEST_TEAR_DOWN(vi64ops) {}
</span> 
 #include "libntptest.h"
 
<span style="color: #000000;background-color: #ffdddd">-extern "C" {
</span> #include "vint64ops.h"
<span style="color: #000000;background-color: #ffdddd">-}
</span> 
<span style="color: #000000;background-color: #ffdddd">-class vi64Test : public libntptest {
-public:
-       bool IsEqual(const vint64 &expected, const vint64 &actual) {
-               if (0 == memcmp(&expected, &actual, sizeof(vint64))) {
-                       return true;
-               } else {
-                       return false
-                           << "expected: "
-                           << std::hex << expected.D_s.hi << '.'
-                           << std::hex << expected.D_s.lo
-                           << " but was "
-                           << std::hex << actual.D_s.hi << '.'
-                           << std::hex << actual.D_s.lo;
-               }
</span><span style="color: #000000;background-color: #ddffdd">+bool IsEqual(const vint64 *expected, const vint64 *actual) {
+       if (0 == memcmp(expected, actual, sizeof(vint64))) {
+               return true;
+       } else {
+               printf("Expected: %04x.%04x but was: %04x.%04x\n", expected->D_s.hi, expected->D_s.lo, actual->D_s.hi, actual->D_s.lo);
+               return false;
+//                 << "expected: "
+//                 << std::hex << expected.D_s.hi << '.'
+//                 << std::hex << expected.D_s.lo
+//                 << " but was "
+//                 << std::hex << actual.D_s.hi << '.'
+//                 << std::hex << actual.D_s.lo;
</span>   }
<span style="color: #000000;background-color: #ffdddd">-};
</span><span style="color: #000000;background-color: #ddffdd">+}
</span> 
 // ----------------------------------------------------------------------
 // test number parser
<span style="color: #000000;background-color: #ffdddd">-TEST(vi64, ParseVUI64_pos) {
</span><span style="color: #000000;background-color: #ddffdd">+TEST(vi64ops, ParseVUI64_pos) {
</span>   vint64 act, exp;
        const char *sp;
        char       *ep;
<span style="color: #aaaaaa">@@ -43,11 +37,11 @@ TEST(vi64, ParseVUI64_pos) {
</span>   exp.D_s.hi = 0;
        exp.D_s.lo = 1234;
        act        = strtouv64(sp, &ep, 0);
<span style="color: #000000;background-color: #ffdddd">-        TEST_ASSERT_TRUE(IsEqual(exp, act));
</span><span style="color: #000000;background-color: #ddffdd">+   TEST_ASSERT_TRUE(IsEqual(&exp, &act));
</span>   TEST_ASSERT_EQUAL(*ep, 'x');
 }
 
<span style="color: #000000;background-color: #ffdddd">-TEST(vi64, ParseVUI64_neg) {
</span><span style="color: #000000;background-color: #ddffdd">+TEST(vi64ops, ParseVUI64_neg) {
</span>   vint64 act, exp;
        const char *sp;
        char       *ep;
<span style="color: #aaaaaa">@@ -56,11 +50,11 @@ TEST(vi64, ParseVUI64_neg) {
</span>   exp.D_s.hi = ~0;
        exp.D_s.lo = -1234;
        act        = strtouv64(sp, &ep, 0);
<span style="color: #000000;background-color: #ffdddd">-        TEST_ASSERT_TRUE(IsEqual(exp, act));
</span><span style="color: #000000;background-color: #ddffdd">+   TEST_ASSERT_TRUE(IsEqual(&exp, &act));
</span>   TEST_ASSERT_EQUAL(*ep, 'x');
 }
 
<span style="color: #000000;background-color: #ffdddd">-TEST(vi64, ParseVUI64_case) {
</span><span style="color: #000000;background-color: #ddffdd">+TEST(vi64ops, ParseVUI64_case) {
</span>   vint64 act, exp;
        const char *sp;
        char       *ep;
<span style="color: #aaaaaa">@@ -69,13 +63,13 @@ TEST(vi64, ParseVUI64_case) {
</span>   exp.D_s.hi = 0x01234567;
        exp.D_s.lo = 0x89ABCDEF;
        act        = strtouv64(sp, &ep, 16);
<span style="color: #000000;background-color: #ffdddd">-        TEST_ASSERT_TRUE(IsEqual(exp, act));
</span><span style="color: #000000;background-color: #ddffdd">+   TEST_ASSERT_TRUE(IsEqual(&exp, &act));
</span>   TEST_ASSERT_EQUAL(*ep, '\0');
 }
 
 
<span style="color: #000000;background-color: #ffdddd">-TEST_GROUP_RUNNER(vi64) {
-       RUN_TEST_CASE(vi64, ParseVUI64_pos);
-       RUN_TEST_CASE(vi64, ParseVUI64_neg);
-       RUN_TEST_CASE(vi64, ParseVUI64_case);
</span><span style="color: #000000;background-color: #ddffdd">+TEST_GROUP_RUNNER(vi64ops) {
+       RUN_TEST_CASE(vi64ops, ParseVUI64_pos);
+       RUN_TEST_CASE(vi64ops, ParseVUI64_neg);
+       RUN_TEST_CASE(vi64ops, ParseVUI64_case);
</span> }
</code></pre>

<br>
</li>
<li id='diff-7'>
<a href='https://gitlab.com/NTPsec/ntpsec/compare/92ecea22056735e1b962793368966e2286249f3b...bce7a4b7ddbd1998c367be12f19a5d73d27cb90e#diff-7'>
<strong>
tests/wscript
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/wscript
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/wscript
</span><span style="color: #aaaaaa">@@ -55,7 +55,7 @@ def build(ctx):
</span> #         "libntp/calendar.c",
 #              "libntp/caljulian.c",
 #              "libntp/caltontp.c",
<span style="color: #000000;background-color: #ffdddd">-#               "libntp/calyearstart.c",
</span><span style="color: #000000;background-color: #ddffdd">+           "libntp/calyearstart.c",
</span> #         "libntp/clocktime.c",
 #              "libntp/decodenetnum.c",
 #              "libntp/hextolfp.c",
<span style="color: #aaaaaa">@@ -80,14 +80,14 @@ def build(ctx):
</span> #         "libntp/timevalops.c",
                "libntp/tstotv.c",
                "libntp/tvtots.c",
<span style="color: #000000;background-color: #ffdddd">-#               "libntp/vi64ops.c",
</span><span style="color: #000000;background-color: #ddffdd">+           "libntp/vi64ops.c",
</span> #         "libntp/ymd2yd.c"
<span style="color: #000000;background-color: #ffdddd">-        ] + common_source
</span><span style="color: #000000;background-color: #ddffdd">+   ] + common_source + ["common/caltime.c"]
</span> 
        ctx.ntp_test(
                features    = "c cprogram bld_include src_include libisc_include test",
         target      = "test_libntp",
<span style="color: #000000;background-color: #ffdddd">-                defines         = ["TEST_LIBNTP_SSL"],
</span><span style="color: #000000;background-color: #ddffdd">+           defines         = ["TEST_LIBNTP=1"],
</span>           includes        = [
                        "%s/tests/unity/" % srcnode,
                        "%s/tests/libntp/" % srcnode,
</code></pre>

<br>
</li>

</div>
<div class='footer' style='margin-top: 10px;'>
<p>

<br>
<a href="https://gitlab.com/NTPsec/ntpsec/compare/92ecea22056735e1b962793368966e2286249f3b...bce7a4b7ddbd1998c367be12f19a5d73d27cb90e">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":["merge_requests","issues","commit"],"url":"https://gitlab.com/NTPsec/ntpsec/compare/92ecea22056735e1b962793368966e2286249f3b...bce7a4b7ddbd1998c367be12f19a5d73d27cb90e"}}</script>
</p>
</div>
</body>
</html>