]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
tests/libntp cleanup for Unity
authorHarlan Stenn <stenn@ntp.org>
Sat, 20 Jun 2015 04:00:43 +0000 (04:00 +0000)
committerHarlan Stenn <stenn@ntp.org>
Sat, 20 Jun 2015 04:00:43 +0000 (04:00 +0000)
bk: 5584e56bMTvWZhhDx9cy4fZQrl0_0w

85 files changed:
tests/libntp/Makefile.am
tests/libntp/c_lfptest.h [deleted file]
tests/libntp/c_sockaddrtest.h [deleted file]
tests/libntp/clocktime.c
tests/libntp/decodenetnum.c
tests/libntp/g_a_md5encrypt.cpp
tests/libntp/g_atoint.cpp
tests/libntp/g_atouint.cpp
tests/libntp/g_authkeys.cpp
tests/libntp/g_buftvtots.cpp [moved from tests/libntp/buftvtots.cpp with 100% similarity]
tests/libntp/g_calendar.cpp
tests/libntp/g_caljulian.cpp
tests/libntp/g_caltontp.cpp
tests/libntp/g_calyearstart.cpp
tests/libntp/g_clocktime.cpp
tests/libntp/g_hextoint.cpp
tests/libntp/g_humandate.cpp
tests/libntp/g_lfpfunc.cpp
tests/libntp/g_lfptest.h [new file with mode: 0644]
tests/libntp/g_lfptostr.cpp
tests/libntp/g_libntptest.cpp [moved from tests/libntp/libntptest.cpp with 95% similarity]
tests/libntp/g_libntptest.h [moved from tests/libntp/libntptest.h with 100% similarity]
tests/libntp/g_modetoa.cpp
tests/libntp/g_msyslog.cpp
tests/libntp/g_numtoa.cpp
tests/libntp/g_numtohost.cpp
tests/libntp/g_octtoint.cpp
tests/libntp/g_prettydate.cpp
tests/libntp/g_recvbuff.cpp
tests/libntp/g_refnumtoa.cpp
tests/libntp/g_sfptostr.cpp
tests/libntp/g_sockaddrtest.h [new file with mode: 0644]
tests/libntp/g_ssl_init.cpp
tests/libntp/g_statestr.cpp
tests/libntp/g_timespecops.cpp
tests/libntp/g_timestructs.cpp [moved from tests/libntp/timestructs.cpp with 98% similarity]
tests/libntp/g_timestructs.h [moved from tests/libntp/c_timestructs.h with 83% similarity]
tests/libntp/g_timevalops.cpp
tests/libntp/g_tstotv.cpp
tests/libntp/g_uglydate.cpp
tests/libntp/g_vi64ops.cpp
tests/libntp/g_ymd2yd.cpp
tests/libntp/hextolfp.c
tests/libntp/humandate.c
tests/libntp/lfpfunc.c
tests/libntp/lfptest.h
tests/libntp/lfptostr.c
tests/libntp/msyslog.c
tests/libntp/netof.c
tests/libntp/octtoint.c
tests/libntp/prettydate.c
tests/libntp/recvbuff.c
tests/libntp/refnumtoa.c
tests/libntp/run-clocktime.c
tests/libntp/run-hextolfp.c
tests/libntp/run-humandate.c
tests/libntp/run-lfpfunc.c
tests/libntp/run-lfptostr.c
tests/libntp/run-msyslog.c
tests/libntp/run-octtoint.c
tests/libntp/run-prettydate.c
tests/libntp/run-recvbuff.c
tests/libntp/run-refnumtoa.c
tests/libntp/run-socktoa.c
tests/libntp/run-ssl_init.c
tests/libntp/run-strtolfp.c
tests/libntp/run-timespecops.c
tests/libntp/run-timevalops.c
tests/libntp/run-tstotv.c
tests/libntp/run-tvtots.c
tests/libntp/run-uglydate.c
tests/libntp/sockaddrtest.h
tests/libntp/socktoa.c
tests/libntp/ssl_init.c
tests/libntp/strtolfp.c
tests/libntp/test-libntp.c
tests/libntp/testcalshims.h
tests/libntp/timespecops.c
tests/libntp/timestructs.c [moved from tests/libntp/c_timestructs.c with 100% similarity]
tests/libntp/timestructs.h
tests/libntp/timevalops.c
tests/libntp/tstotv.c
tests/libntp/tvtots.c
tests/libntp/uglydate.c
tests/libntp/vi64ops.c

index 0f787428445a2ac0c17ae18ec410ae6459ceeda8..656351c56cc8c72e0e5449b3649af3f52de21559 100644 (file)
@@ -81,12 +81,12 @@ AM_LDFLAGS = $(LDFLAGS_NTP)
 
 tests_SOURCES =                                        \
        $(top_srcdir)/sntp/tests_main.cpp       \
-       libntptest.cpp          \
+       g_libntptest.cpp        \
        g_a_md5encrypt.cpp      \
        g_atoint.cpp            \
        g_atouint.cpp           \
        g_authkeys.cpp          \
-       buftvtots.cpp           \
+       g_buftvtots.cpp         \
        g_calendar.cpp          \
        g_caljulian.cpp         \
        g_caltontp.cpp          \
@@ -113,7 +113,7 @@ tests_SOURCES =                                     \
        g_statestr.cpp          \
        g_strtolfp.cpp          \
        g_timespecops.cpp       \
-       timestructs.cpp         \
+       g_timestructs.cpp               \
        g_timevalops.cpp        \
        g_tstotv.cpp            \
        g_tvtots.cpp            \
@@ -162,12 +162,12 @@ BUILT_SOURCES +=                  \
        $(NULL)
 
 noinst_HEADERS =       \
+       g_lfptest.h     \
        lfptest.h       \
-       c_lfptest.h     \
-       libntptest.h    \
+       g_libntptest.h  \
+       g_sockaddrtest.h        \
        sockaddrtest.h  \
-       c_sockaddrtest.h\
-       timestructs.h   \
+       g_timestructs.h \
        test-libntp.h   \
        $(NULL)
 
diff --git a/tests/libntp/c_lfptest.h b/tests/libntp/c_lfptest.h
deleted file mode 100644 (file)
index 7949821..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef NTP_TESTS_LFPTEST_H
-#define NTP_TESTS_LFPTEST_H
-
-#include "ntp_fp.h"
-
-int IsEqual(const l_fp expected, const l_fp actual) {
-       if (L_ISEQU(&expected, &actual)) {
-               return TRUE;
-       } else {
-               //printf(" expected: ...");
-               /*
-               << " expected: " << lfptoa(&expected, FRACTION_PREC)
-                               << " (" << expected.l_ui << "." << expected.l_uf << ")"
-                               << " but was: " << lfptoa(&actual, FRACTION_PREC)
-                               << " (" << actual.l_ui << "." << actual.l_uf << ")";
-               */
-               return FALSE;
-       }
-
-}
-
-static const int32 HALF = -2147483647L - 1L;
-static const int32 HALF_PROMILLE_UP = 2147484; // slightly more than 0.0005
-static const int32 HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
-static const int32 QUARTER = 1073741824L;
-static const int32 QUARTER_PROMILLE_APPRX = 1073742L;
-
-#endif
-
-
diff --git a/tests/libntp/c_sockaddrtest.h b/tests/libntp/c_sockaddrtest.h
deleted file mode 100644 (file)
index f9a9fde..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef TESTS_SOCKADDRTEST_H
-#define TESTS_SOCKADDRTEST_H
-
-#include "ntp.h"
-#include "ntp_stdlib.h"
-
-sockaddr_u CreateSockaddr4(const char* address, unsigned int port) {
-       sockaddr_u s;
-       s.sa4.sin_family = AF_INET;
-       s.sa4.sin_addr.s_addr = inet_addr(address);
-       SET_PORT(&s, port);
-
-       return s;
-}
-
-int IsEqual(const sockaddr_u expected, const sockaddr_u actual) {
-       struct in_addr in;
-       struct in6_addr in6;
-
-       if (expected.sa.sa_family != actual.sa.sa_family) {
-               //<< "Expected sa_family: " << expected.sa.sa_family
-               //<< " but got: " << actual.sa.sa_family;
-               return FALSE;
-       }
-
-       if (actual.sa.sa_family == AF_INET) { // IPv4
-               if (expected.sa4.sin_port == actual.sa4.sin_port &&
-                       memcmp(&expected.sa4.sin_addr, &actual.sa4.sin_addr,
-                                  sizeof( in )) == 0) {
-                       return TRUE;
-               } else {
-                       //<< "IPv4 comparision failed, expected: "
-                       //<< expected.sa4.sin_addr.s_addr
-                       //<< "(" << socktoa(&expected) << ") but was: "
-                       //<< actual.sa4.sin_addr.s_addr "(" << socktoa(&actual) << ")";
-                       return FALSE;
-               }
-       } else if (actual.sa.sa_family == AF_INET6) { //IPv6
-               if (expected.sa6.sin6_port == actual.sa6.sin6_port &&
-                       memcmp(&expected.sa6.sin6_addr, &actual.sa6.sin6_addr,
-                                  sizeof(in6)) == 0) {
-                       return TRUE;
-               } else {
-                       printf("IPv6 comparision failed");
-                       return FALSE;
-               }
-       } else { // Unknown family
-               printf("Unknown sa_family: ");// << actual.sa.sa_family;
-               return FALSE;
-       }
-}
-
-
-#endif // TESTS_SOCKADDRTEST_H
-
-
-
index 3281975ec12b964513b055e2d6cf3c723da0cd27..a9c0fec82648a8b8d58e1f260da37510f4805696 100644 (file)
@@ -1,16 +1,12 @@
 #include "config.h"
 
-#include <stdlib.h>
-
 #include "ntp_calendar.h"
-#include "unity.h"
 #include "ntp_stdlib.h"
 
-
+#include "unity.h"
 #include "test-libntp.h"
 
 
-
 // ---------------------------------------------------------------------
 // test fixture
 //
index 8d29eb64cbdcfff8884ea5b0a0f07f8b4c054ac0..681b7125a017a06a0762cc055b99347d08f0d207 100644 (file)
@@ -3,7 +3,7 @@
 #include "ntp_calendar.h"
 #include "unity.h"
 
-#include "c_sockaddrtest.h"
+#include "sockaddrtest.h"
 
 
 void test_IPv4AddressOnly(void) {
index f4cea7e54981979cbf362ee518dc71dc5b4334fc..691bf78e2722853398b7290359e099d46cc06cc5 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #ifdef OPENSSL
index 371f3fe0a2a139270ad34c1901d181e33326ae84..9a8283fd2a2681af97f0c60fd7659d231caafa5e 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 class atointTest : public libntptest {
 };
index cc8cc394b840a8ff6258b6e634b34977c2b107cd..ba261dbb10aca68b956d2d9ae0f112e03daffd10 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 class atouintTest : public libntptest {
 };
index 8dd33a9accfe2a6b1caad42f699a7eacb7089ee3..773112e5232359308052aed5f05fd8ff6ab3ebc2 100644 (file)
@@ -1,6 +1,6 @@
 /* This file contains test for both libntp/authkeys.c and libntp/authusekey.c */
 
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #ifdef OPENSSL
index 35b39c7e529f0964d11a48c3cb9a8f00db0f151c..2db9ff78f496e749d4a8b17e16e13c64ea43a6a2 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "ntp_calendar.h"
index d9cc952933e7e60b23dfe7bf00c9f68b1d05c9ee..7ed38c43b6d9820c327ccd8c89b1948f0c0470ff 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "ntp_calendar.h"
index b9732db3273d053da1930e464479a6ee0e7db8a5..7dafec0ab19c1952cda0661b41b1cbccd486c103 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "ntp_calendar.h"
index 774edf3eae44c694d9b4b94feae680512ece84c6..59859be61c5764bb45fb8d6354e35f5bf90985d9 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 class calyearstartTest : public libntptest {
 protected:
index a24df1af48e32120a7cd777a6de5bae6101d969c..ee496d2527738132e2ee17b281eaea04058b3b29 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 // ---------------------------------------------------------------------
 // test fixture
index 54c9a67aa149196dae79e4d92bc529b83853b6ee..c20821a9b5e8725f244d4df9a5e535384bab6a4b 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 class hextointTest : public libntptest {
 };
index 742aa28724ab8e6dd8ba24e19b4db960e7a3b484..a50ae53408930e0c72da2d2ffdf312bd8d06b9d5 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 #include <sstream>
 #include <string>
index 275918cdc50f7d29fef5837088406263735cc120..c9aaf9f2352f046061ee351dda48bce07645cc5a 100644 (file)
@@ -1,5 +1,5 @@
-#include "libntptest.h"
-#include "timestructs.h"
+#include "g_libntptest.h"
+#include "g_timestructs.h"
 
 extern "C" {
 #include "ntp_fp.h"
diff --git a/tests/libntp/g_lfptest.h b/tests/libntp/g_lfptest.h
new file mode 100644 (file)
index 0000000..1daffef
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef NTP_TESTS_LFPTEST_H
+#define NTP_TESTS_LFPTEST_H
+
+#include "g_libntptest.h"
+
+extern "C" {
+#include "ntp_fp.h"
+};
+
+class lfptest : public libntptest {
+protected:
+       ::testing::AssertionResult IsEqual(const l_fp &expected, const l_fp &actual) {
+               if (L_ISEQU(&expected, &actual)) {
+                       return ::testing::AssertionSuccess();
+               } else {
+                       return ::testing::AssertionFailure()
+                               << " expected: " << lfptoa(&expected, FRACTION_PREC)
+                               << " (" << expected.l_ui << "." << expected.l_uf << ")"
+                               << " but was: " << lfptoa(&actual, FRACTION_PREC)
+                               << " (" << actual.l_ui << "." << actual.l_uf << ")";
+               }
+       }
+
+       static const int32 HALF = -2147483647L - 1L;
+       static const int32 HALF_PROMILLE_UP = 2147484; // slightly more than 0.0005
+       static const int32 HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
+       static const int32 QUARTER = 1073741824L;
+       static const int32 QUARTER_PROMILLE_APPRX = 1073742L;
+};
+
+#endif
+/* NTP_TESTS_LFPTEST_H */
index aa5f5112d663db926e6ad2aac384ffb28a1fd75c..ae594a67cf9a46749fcfb81f24075a741c4ff4dc 100644 (file)
@@ -4,7 +4,7 @@
  * a macro.
  */
 
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "ntp_fp.h"
similarity index 95%
rename from tests/libntp/libntptest.cpp
rename to tests/libntp/g_libntptest.cpp
index c3363b008bdbe2a0f97845bd9c3f4160ec93f684..8897b5c098c3cbe855c2ede7ebd96b1cb2f2a9d2 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 /* This file contains various constants that libntp needs to be set
  *  and that is normally defined in ntpd/ntpq/...
index cb7404d0393f24f977a54a4942d835ea38592c66..96bf3ce5995218287232ef7eef8a18f14df98c61 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 class modetoaTest : public libntptest {
 };
index 5b00703e6a7dbb797a7500a933968dc70b6ee651..273600d3a84a45df944e7e5d9974fefbb177710e 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include <stdio.h>
index 58e00c4c27ec656e7d393212af46af26694081bf..a68e80dbd65d44a3b75b032c0371b896e910ae33 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 class numtoaTest : public libntptest {
 };
index ffc574ee85b3119791aa5f52c6b358190534218d..e04cad8a6833584d07b869b0d9438321faf548c9 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 class numtohostTest : public libntptest {
 };
index 14a993e035a19b6775f5024d75ec69880422dd11..8731eed63240730be38f44913f27d0bd81368996 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 class octtointTest : public libntptest {
 };
index 391ac29a85f50efaf9663f50a521d023cbbcf4ac..45741b5a93dee38d079408c3ec4c15fe9b85db0f 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "ntp_fp.h"
index e9505bd7c1cfec3343d31b693b2b370a83e584e7..799802d8b484bd52c7438b5134d59f7a90f8c953 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "recvbuff.h"
index 75460c0b52ba5c704b0ab6a54bbb8c28a6a01fe7..91648aa024b4eb6b326e5063fcc8e22eacbb6514 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 #include "ntp_net.h"
 #include "ntp_refclock.h"
index 5cef47e3cdc27483f05956e08892ead765712df6..c31b30c90be5b2f723b8efd6049a6782a1ab6ec4 100644 (file)
@@ -3,7 +3,7 @@
  * since all these functions are very similar.
  */
 
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "ntp_fp.h"
diff --git a/tests/libntp/g_sockaddrtest.h b/tests/libntp/g_sockaddrtest.h
new file mode 100644 (file)
index 0000000..819a54f
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef TESTS_SOCKADDRTEST_H
+#define TESTS_SOCKADDRTEST_H
+
+#include "g_libntptest.h"
+
+extern "C" {
+#include "ntp.h"
+};
+
+class sockaddrtest : public libntptest {
+protected:
+       ::testing::AssertionResult IsEqual(const sockaddr_u &expected, const sockaddr_u &actual) {
+               if (expected.sa.sa_family != actual.sa.sa_family) {
+                       return ::testing::AssertionFailure()
+                               << "Expected sa_family: " << expected.sa.sa_family
+                               << " but got: " << actual.sa.sa_family;
+               }
+
+               if (actual.sa.sa_family == AF_INET) { // IPv4
+                       if (expected.sa4.sin_port == actual.sa4.sin_port &&
+                               memcmp(&expected.sa4.sin_addr, &actual.sa4.sin_addr,
+                                          sizeof(in_addr)) == 0) {
+                               return ::testing::AssertionSuccess();
+                       } else {
+                               return ::testing::AssertionFailure()
+                                       << "IPv4 comparision failed, expected: "
+                                       << expected.sa4.sin_addr.s_addr
+                                       << "(" << socktoa(&expected) << ")"
+                                       << " but was: "
+                                       << actual.sa4.sin_addr.s_addr
+                                       << "(" << socktoa(&actual) << ")";
+                       }
+               } else if (actual.sa.sa_family == AF_INET6) { //IPv6
+                       if (expected.sa6.sin6_port == actual.sa6.sin6_port &&
+                               memcmp(&expected.sa6.sin6_addr, &actual.sa6.sin6_addr,
+                                          sizeof(in6_addr)) == 0) {
+                               return ::testing::AssertionSuccess();
+                       } else {
+                               return ::testing::AssertionFailure()
+                                       << "IPv6 comparision failed";
+                       }
+               } else { // Unknown family
+                       return ::testing::AssertionFailure()
+                               << "Unknown sa_family: " << actual.sa.sa_family;
+               }
+       }
+
+       sockaddr_u CreateSockaddr4(const char* address, unsigned int port) {
+               sockaddr_u s;
+               s.sa4.sin_family = AF_INET;
+               s.sa4.sin_addr.s_addr = inet_addr(address);
+               SET_PORT(&s, port);
+
+               return s;
+       }
+};
+
+#endif // TESTS_SOCKADDRTEST_H
+
index 8812656c3142e5d755e0cb45dba04bfff2381a9c..16b2f4d4384a5f2a7b3e50d4d73a7f7c05f8eb85 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #ifdef OPENSSL
index bfd437865417581d52b4d74ef252d9e55287e640..dedbf5b002b01808e1e8b8a7f37fc6b0c4c1b13c 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "ntp.h" // Needed for MAX_MAC_LEN used in ntp_control.h
index 392d271020a5b6565703b00f17ee8136be029421..0cc573ff4f14b5a4a2157b10ee68c530e6767153 100644 (file)
@@ -1,5 +1,5 @@
-#include "libntptest.h"
-#include "timestructs.h"
+#include "g_libntptest.h"
+#include "g_timestructs.h"
 
 extern "C" {
 #include <math.h>
similarity index 98%
rename from tests/libntp/timestructs.cpp
rename to tests/libntp/g_timestructs.cpp
index 3cd0c543fb004c272679235b197d11cd4b587d18..15b5ec164aa328307bb2d5d0223f2eda8d13d90a 100644 (file)
@@ -4,8 +4,8 @@
  * Written by Juergen Perlinger (perlinger@ntp.org) for the NTP project.
  * The contents of 'html/copyright.html' apply.
  */
-#include "libntptest.h"
-#include "timestructs.h"
+#include "g_libntptest.h"
+#include "g_timestructs.h"
 
 extern "C" {
 #include "timetoa.h"
similarity index 83%
rename from tests/libntp/c_timestructs.h
rename to tests/libntp/g_timestructs.h
index 8cd59270d7939ede8dc2ccbd476c5ab7f4ce31a2..7bc4ffdcf8caada13fc23288abf706a2c1dcef67 100644 (file)
  * HRVs (human readable values) but we might also be interested in the
  * machine representation for diagnostic purposes.
  */
-
-
-//#ifndef TESTCALSHIMS_H
-#include "testcalshims.h"
-//#endif
-
-
 #ifndef TIMESTRUCTS_H
 #define TIMESTRUCTS_H
 
+extern "C" {
 #include "ntp_fp.h"
+}
 
-
-l_fp test ; 
-//namespace timeStruct {
+namespace timeStruct {
 
 // wrap a l_fp struct with common operations
-struct l_fp_wrap {
-  
+class l_fp_wrap {
+  public:
        l_fp V;
        
-       
-       //bool operator == (const l_fp_wrap& rhs) const
-       //      { return L_ISEQU(&V, &rhs.V); }
-
-//---------------THIS HAS TO BE MANUALLY CONVERTED IN CODE!!!
-       //operator l_fp* () 
-       //      { return &V; }
-       //operator l_fp& ()
-       //      { return V; }
-//-----------------------------------------
-/*
+       l_fp_wrap()
+               { ZERO(V); }
+       l_fp_wrap(u_int32 hi, u_int32 lo)
+               { V.l_ui = hi; V.l_uf = lo; }
+       l_fp_wrap(const l_fp &rhs)
+               { V = rhs; }
+       bool operator == (const l_fp_wrap& rhs) const
+               { return L_ISEQU(&V, &rhs.V); }
+       operator l_fp* () 
+               { return &V; }
+       operator l_fp& ()
+               { return V; }
        l_fp_wrap & operator = (const l_fp_wrap& rhs)
                { V = rhs.V; return *this; }
        l_fp_wrap& operator = (const l_fp& rhs)
                { V = rhs; return *this; }
-*/
-};
-
-l_fp_wrap(l_fp V){
-       ZERO(V); }
-l_fp_wrap(l_fp V, u_int32 hi, u_int32 lo){
-       V.l_ui = hi; V.l_uf = lo; }
-l_fp_wrap(l_fp V, const l_fp &rhs){
-       V = rhs; }
-
-l_fp_wrap_equals(const l_fp_wrap& current, const l_fp_wrap& rhs) const // operator ==
-       { return L_ISEQU(&current.V, &rhs.V); }
-
-l_fp_wrap_and(const l_fp_wrap& current, const l_fp_wrap& rhs){
-       V = rhs.V; 
-       return current//*this;
-}
-l_fp_wrap_and(const l_fp& current, const l_fp& rhs){ 
-       V = rhs; 
-       return current//*this; 
-}
-
+       };
        
-
 // wrap a 'struct timeval' with common operations
-struct timeval_wrap {
-
+class timeval_wrap {
+public:
        struct timeval V;
 
        timeval_wrap()
@@ -102,8 +74,8 @@ struct timeval_wrap {
 };
 
 // wrap a 'struct timespec' with common operations
-struct timespec_wrap {
-
+class timespec_wrap {
+public:
        struct timespec V;
 
        timespec_wrap()
@@ -208,6 +180,6 @@ extern std::ostream& operator << (std::ostream& os,
 extern std::ostream& operator << (std::ostream& os,
                                  const timeStruct::timespec_wrap& val);
 
-//} // namespace timeStruct
+} // namespace timeStruct
 
 #endif // TIMESTRUCTS_H
index 7232615b91bcea63696c32800fbcc53c077a93c4..8c171fca092829de009f742c975a71279d404b19 100644 (file)
@@ -1,5 +1,5 @@
-#include "libntptest.h"
-#include "timestructs.h"
+#include "g_libntptest.h"
+#include "g_timestructs.h"
 
 extern "C" {
 #include <math.h>
index 41f44d70e00b3038521b415e3b94257c3654ff77..30f4ca6a758f93c2088e88011a52d1256f7f3b61 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "ntp_fp.h"
index 6d9e6c6aceb863797857f72b489448a77d401d85..12aa0025cab2190cf70e61c04b67a6291b80f065 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "ntp_fp.h"
index 7b839ab371d4596ff6acb2b4c35547d05f1baba1..29f7932b37a0c73920e73d049a9d42e11c587f28 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 extern "C" {
 #include "vint64ops.h"
index e6f46f8c080b9a6fde0bfa9b4229f0a643538ed7..7e2599960124077edd1ffb5c8fa04710d02e3968 100644 (file)
@@ -1,4 +1,4 @@
-#include "libntptest.h"
+#include "g_libntptest.h"
 
 class ymd2ydTest : public libntptest {
 };
index 0a4a6f9cf2dea54455410009ca13831dc25b6baa..a2f548f5664483bc88e753fe8a7f8cba0f5b1e6f 100644 (file)
@@ -1,8 +1,10 @@
 #include "config.h"
+
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
+
 #include "unity.h"
-#include "c_lfptest.h"
+#include "lfptest.h"
 
 
 void test_PositiveInteger(void) {
index 36cbe2b9cab455e99110c5de21dd5dc87c620cb5..071fa415990029e2b1bc4333a93771b92fedcb0d 100644 (file)
@@ -1,8 +1,9 @@
 #include "config.h"
-#include "unity.h"
+
 #include "ntp_calendar.h"
 #include "ntp_stdlib.h"
-#include <stdio.h>
+
+#include "unity.h"
 
 void test_RegularTime(void)
 {
index e38104f8fee0a3bd15e2c1a57cc9ab6c81e45615..72c564026239b7546a25e592cdf7b98374997ea9 100644 (file)
@@ -9,8 +9,6 @@
 #include <float.h>
 #include <math.h>
 
-#include <string.h>
-
 
 typedef struct  {
        uint32_t h, l;
index 85179b811c11f4aafeb11a02130ff94d945f008c..7949821a2063c4b9716265cfc8627ca115ee1ab2 100644 (file)
@@ -1,32 +1,30 @@
 #ifndef NTP_TESTS_LFPTEST_H
 #define NTP_TESTS_LFPTEST_H
 
-#include "libntptest.h"
-
-extern "C" {
 #include "ntp_fp.h"
-};
 
-class lfptest : public libntptest {
-protected:
-       ::testing::AssertionResult IsEqual(const l_fp &expected, const l_fp &actual) {
-               if (L_ISEQU(&expected, &actual)) {
-                       return ::testing::AssertionSuccess();
-               } else {
-                       return ::testing::AssertionFailure()
-                               << " expected: " << lfptoa(&expected, FRACTION_PREC)
+int IsEqual(const l_fp expected, const l_fp actual) {
+       if (L_ISEQU(&expected, &actual)) {
+               return TRUE;
+       } else {
+               //printf(" expected: ...");
+               /*
+               << " expected: " << lfptoa(&expected, FRACTION_PREC)
                                << " (" << expected.l_ui << "." << expected.l_uf << ")"
                                << " but was: " << lfptoa(&actual, FRACTION_PREC)
                                << " (" << actual.l_ui << "." << actual.l_uf << ")";
-               }
+               */
+               return FALSE;
        }
 
-       static const int32 HALF = -2147483647L - 1L;
-       static const int32 HALF_PROMILLE_UP = 2147484; // slightly more than 0.0005
-       static const int32 HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
-       static const int32 QUARTER = 1073741824L;
-       static const int32 QUARTER_PROMILLE_APPRX = 1073742L;
-};
+}
+
+static const int32 HALF = -2147483647L - 1L;
+static const int32 HALF_PROMILLE_UP = 2147484; // slightly more than 0.0005
+static const int32 HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
+static const int32 QUARTER = 1073741824L;
+static const int32 QUARTER_PROMILLE_APPRX = 1073742L;
 
 #endif
-/* NTP_TESTS_LFPTEST_H */
+
+
index a5f67fb8c55947794cb88c775782d7f7ed13928a..c76e07fb0ed87b34d589b864838286c8473258ee 100644 (file)
@@ -7,9 +7,10 @@
 #include "config.h"
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
-#include "unity.h"
 #include "ntp_fp.h"
 
+#include "unity.h"
+
 static const int LFP_MAX_PRECISION = 10;
 static const int LFP_MAX_PRECISION_MS = 7;
 
index 5e2a1f82e5112c981569beea735e2c3d15115d27..c9d6d2daf8a1c198e691338bb9aadf37af0be837 100644 (file)
@@ -1,8 +1,7 @@
 #include "config.h"
+
 #include "ntp_stdlib.h"
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
+
 #include "unity.h"
 
 #ifndef VSNPRINTF_PERCENT_M
index c6434448d310f85b1fdfcbf9424765cde4d5b1d5..010b16429365d4657f8b8b5f7fe8743695d3d4f3 100644 (file)
@@ -1,11 +1,11 @@
 #include "config.h"
+
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
+
 #include "unity.h"
-//#include "ntp.h"
-//#include "ntp_net.h"
 
-#include "c_sockaddrtest.h"
+#include "sockaddrtest.h"
 
 void test_ClassBAddress(void) {
        sockaddr_u input = CreateSockaddr4("172.16.2.1", NTP_PORT);
index 3541b2106dc80399c9de05e304c763bf767ccde6..4b0f94ceaa36a5b7637ada04684dabd37278682f 100644 (file)
@@ -1,8 +1,7 @@
 #include "config.h"
 
 #include "ntp_stdlib.h"
-//#include "ntp_calendar.h"
-//#include "ntp_fp.h"
+
 #include "unity.h"
 
 void test_SingleDigit(void) {
@@ -11,7 +10,6 @@ void test_SingleDigit(void) {
 
        TEST_ASSERT_TRUE(octtoint(str, &actual) );
        TEST_ASSERT_EQUAL(5, actual);
-
 }
 
 void test_MultipleDigits(void){
index c68dda0ed7c7c93cd39435bc7644621fe06a3498..9a331e828db4aaf360a7cff0be1f022b31a23a26 100644 (file)
@@ -3,6 +3,7 @@
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
 #include "ntp_fp.h"
+
 #include "unity.h"
 
 void
@@ -13,4 +14,4 @@ test_ConstantDate(void) {
 
        TEST_ASSERT_EQUAL_STRING("cfba1ce0.80000000  Wed, Jun  9 2010 14:00:00.500",
                gmprettydate(&time));
-}
\ No newline at end of file
+}
index 6fb96fb2cd97475ab8c7d45a76eb3fb9bd0cbe32..e9c14da88cdd36eeb3e618a8c551804cca6afab2 100644 (file)
@@ -1,10 +1,9 @@
-//#include "testcalshims.h"
 #include "config.h"
+
 #include "recvbuff.h"
+
 #include "unity.h"
 
-//#include "ntp_stdlib.h"
-//#include "libntptest.h"
 
 void
 setUp(void)
@@ -40,4 +39,4 @@ test_GetAndFill(void) {
        TEST_ASSERT_EQUAL_UINT(1, full_recvbuffs());
        TEST_ASSERT_TRUE(has_full_recv_buffer());
        TEST_ASSERT_EQUAL_PTR(buf, get_full_recv_buffer());
-}
\ No newline at end of file
+}
index 164b22470b67c29505c9b67dfb3580c5e069e757..8a37690ce20093baadb5f63ee551acd45e201d1f 100644 (file)
@@ -1,4 +1,5 @@
 #include "config.h"
+
 #include "ntp_net.h"
 #include "ntp_refclock.h"
 
index 6229933dc7425e4a584bc11049f8a188089a4d81..f21de83eac00a016caaffe4556b98ade29da02a6 100644 (file)
@@ -52,14 +52,14 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "clocktime.c";
   UnityBegin("clocktime.c");
-  RUN_TEST(test_CurrentYear, 36);
-  RUN_TEST(test_CurrentYearFuzz, 51);
-  RUN_TEST(test_TimeZoneOffset, 73);
-  RUN_TEST(test_WrongYearStart, 93);
-  RUN_TEST(test_PreviousYear, 112);
-  RUN_TEST(test_NextYear, 131);
-  RUN_TEST(test_NoReasonableConversion, 149);
-  RUN_TEST(test_AlwaysInLimit, 171);
+  RUN_TEST(test_CurrentYear, 32);
+  RUN_TEST(test_CurrentYearFuzz, 47);
+  RUN_TEST(test_TimeZoneOffset, 69);
+  RUN_TEST(test_WrongYearStart, 89);
+  RUN_TEST(test_PreviousYear, 108);
+  RUN_TEST(test_NextYear, 127);
+  RUN_TEST(test_NoReasonableConversion, 145);
+  RUN_TEST(test_AlwaysInLimit, 167);
 
   return (UnityEnd());
 }
index 9cc331e23224375d662b737916ebfce65cb1a2bd..33a8b94d994d65d24dbdc6639a305cef04ee1161 100644 (file)
@@ -50,12 +50,12 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "hextolfp.c";
   UnityBegin("hextolfp.c");
-  RUN_TEST(test_PositiveInteger, 8);
-  RUN_TEST(test_NegativeInteger, 18);
-  RUN_TEST(test_PositiveFraction, 28);
-  RUN_TEST(test_NegativeFraction, 38);
-  RUN_TEST(test_IllegalNumberOfInteger, 48);
-  RUN_TEST(test_IllegalChar, 55);
+  RUN_TEST(test_PositiveInteger, 10);
+  RUN_TEST(test_NegativeInteger, 20);
+  RUN_TEST(test_PositiveFraction, 30);
+  RUN_TEST(test_NegativeFraction, 40);
+  RUN_TEST(test_IllegalNumberOfInteger, 50);
+  RUN_TEST(test_IllegalChar, 57);
 
   return (UnityEnd());
 }
index be3930d6055d49de8250f285ab648fa8b8c6f42b..291415f532e47225e22c45d9eb14e540da8a64df 100644 (file)
@@ -46,8 +46,8 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "humandate.c";
   UnityBegin("humandate.c");
-  RUN_TEST(test_RegularTime, 7);
-  RUN_TEST(test_CurrentTime, 21);
+  RUN_TEST(test_RegularTime, 8);
+  RUN_TEST(test_CurrentTime, 22);
 
   return (UnityEnd());
 }
index 84f99f50827558235f14555abd6ce2f9a1df16b9..72b616b73b79c996753819ba4aa98bbfc2dd832b 100644 (file)
@@ -53,15 +53,15 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "lfpfunc.c";
   UnityBegin("lfpfunc.c");
-  RUN_TEST(test_AdditionLR, 317);
-  RUN_TEST(test_AdditionRL, 335);
-  RUN_TEST(test_SubtractionLR, 353);
-  RUN_TEST(test_SubtractionRL, 367);
-  RUN_TEST(test_Negation, 384);
-  RUN_TEST(test_Absolute, 403);
-  RUN_TEST(test_FDF_RoundTrip, 434);
-  RUN_TEST(test_SignedRelOps, 465);
-  RUN_TEST(test_UnsignedRelOps, 508);
+  RUN_TEST(test_AdditionLR, 315);
+  RUN_TEST(test_AdditionRL, 333);
+  RUN_TEST(test_SubtractionLR, 351);
+  RUN_TEST(test_SubtractionRL, 365);
+  RUN_TEST(test_Negation, 382);
+  RUN_TEST(test_Absolute, 401);
+  RUN_TEST(test_FDF_RoundTrip, 432);
+  RUN_TEST(test_SignedRelOps, 463);
+  RUN_TEST(test_UnsignedRelOps, 506);
 
   return (UnityEnd());
 }
index 491f7c0dc3e9faffe8fcd6dc68f153338401599b..7e54a4f0c370f23716a29099ef542725f7971036 100644 (file)
@@ -55,17 +55,17 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "lfptostr.c";
   UnityBegin("lfptostr.c");
-  RUN_TEST(test_PositiveInteger, 22);
-  RUN_TEST(test_NegativeInteger, 29);
-  RUN_TEST(test_PositiveIntegerWithFraction, 36);
-  RUN_TEST(test_NegativeIntegerWithFraction, 43);
-  RUN_TEST(test_RoundingDownToInteger, 50);
-  RUN_TEST(test_RoundingMiddleToInteger, 57);
-  RUN_TEST(test_RoundingUpToInteger, 64);
-  RUN_TEST(test_SingleDecimal, 71);
-  RUN_TEST(test_MillisecondsRoundingUp, 78);
-  RUN_TEST(test_MillisecondsRoundingDown, 87);
-  RUN_TEST(test_UnsignedInteger, 96);
+  RUN_TEST(test_PositiveInteger, 23);
+  RUN_TEST(test_NegativeInteger, 30);
+  RUN_TEST(test_PositiveIntegerWithFraction, 37);
+  RUN_TEST(test_NegativeIntegerWithFraction, 44);
+  RUN_TEST(test_RoundingDownToInteger, 51);
+  RUN_TEST(test_RoundingMiddleToInteger, 58);
+  RUN_TEST(test_RoundingUpToInteger, 65);
+  RUN_TEST(test_SingleDecimal, 72);
+  RUN_TEST(test_MillisecondsRoundingUp, 79);
+  RUN_TEST(test_MillisecondsRoundingDown, 88);
+  RUN_TEST(test_UnsignedInteger, 97);
 
   return (UnityEnd());
 }
index 8ec7c24c6e2e351169e42027c5118613b149e096..3da1b78f7334e09c03456587f799e395bdbd62b4 100644 (file)
@@ -52,14 +52,14 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "msyslog.c";
   UnityBegin("msyslog.c");
-  RUN_TEST(test_msnprintf, 15);
-  RUN_TEST(test_msnprintfLiteralPercentm, 31);
-  RUN_TEST(test_msnprintfBackslashLiteralPercentm, 46);
-  RUN_TEST(test_msnprintfBackslashPercent, 60);
-  RUN_TEST(test_msnprintfHangingPercent, 75);
-  RUN_TEST(test_format_errmsgHangingPercent, 92);
-  RUN_TEST(test_msnprintfNullTarget, 107);
-  RUN_TEST(test_msnprintfTruncate, 118);
+  RUN_TEST(test_msnprintf, 14);
+  RUN_TEST(test_msnprintfLiteralPercentm, 30);
+  RUN_TEST(test_msnprintfBackslashLiteralPercentm, 45);
+  RUN_TEST(test_msnprintfBackslashPercent, 59);
+  RUN_TEST(test_msnprintfHangingPercent, 74);
+  RUN_TEST(test_format_errmsgHangingPercent, 91);
+  RUN_TEST(test_msnprintfNullTarget, 106);
+  RUN_TEST(test_msnprintfTruncate, 117);
 
   return (UnityEnd());
 }
index 4dd84a0b7177425fb17041bacf1098947623c50e..dc2bed566e17a4c7251f66ae0729e97d92944d62 100644 (file)
@@ -51,13 +51,13 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "octtoint.c";
   UnityBegin("octtoint.c");
-  RUN_TEST(test_SingleDigit, 8);
-  RUN_TEST(test_MultipleDigits, 17);
-  RUN_TEST(test_Zero, 26);
-  RUN_TEST(test_MaximumUnsigned32bit, 35);
-  RUN_TEST(test_Overflow, 44);
-  RUN_TEST(test_IllegalCharacter, 52);
-  RUN_TEST(test_IllegalDigit, 60);
+  RUN_TEST(test_SingleDigit, 7);
+  RUN_TEST(test_MultipleDigits, 15);
+  RUN_TEST(test_Zero, 24);
+  RUN_TEST(test_MaximumUnsigned32bit, 33);
+  RUN_TEST(test_Overflow, 42);
+  RUN_TEST(test_IllegalCharacter, 50);
+  RUN_TEST(test_IllegalDigit, 58);
 
   return (UnityEnd());
 }
index cafdad41f9dc2055b1045220b16cc7e5c50fd2bf..2067b13c5e76ad60118dc9f3e7364c4c32ec84b3 100644 (file)
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "prettydate.c";
   UnityBegin("prettydate.c");
-  RUN_TEST(test_ConstantDate, 9);
+  RUN_TEST(test_ConstantDate, 10);
 
   return (UnityEnd());
 }
index 75adc6b4cc92ceb4d743552818f1b3ead934d754..8060105e316d7d23a1cdf0cd1be12250056a4a29 100644 (file)
@@ -47,9 +47,9 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "recvbuff.c";
   UnityBegin("recvbuff.c");
-  RUN_TEST(test_Initialization, 16);
-  RUN_TEST(test_GetAndFree, 24);
-  RUN_TEST(test_GetAndFill, 35);
+  RUN_TEST(test_Initialization, 15);
+  RUN_TEST(test_GetAndFree, 23);
+  RUN_TEST(test_GetAndFill, 34);
 
   return (UnityEnd());
 }
index 3354da8cf7076f5bd6fa425fb98b00e211a7ce6c..60981ca5aa027e8df474ff2ae2abf9bb8b58cb91 100644 (file)
@@ -46,8 +46,8 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "refnumtoa.c";
   UnityBegin("refnumtoa.c");
-  RUN_TEST(test_LocalClock, 12);
-  RUN_TEST(test_UnknownId, 40);
+  RUN_TEST(test_LocalClock, 13);
+  RUN_TEST(test_UnknownId, 41);
 
   return (UnityEnd());
 }
index 81e4717d0e8cc35391db22a2cd20efc43225bde2..a6fa778341214f09e66487d13404bfe7da4f6efa 100644 (file)
@@ -50,12 +50,12 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "socktoa.c";
   UnityBegin("socktoa.c");
-  RUN_TEST(test_IPv4AddressWithPort, 9);
-  RUN_TEST(test_IPv6AddressWithPort, 16);
-  RUN_TEST(test_ScopedIPv6AddressWithPort, 40);
-  RUN_TEST(test_HashEqual, 65);
-  RUN_TEST(test_HashNotEqual, 73);
-  RUN_TEST(test_IgnoreIPv6Fields, 86);
+  RUN_TEST(test_IPv4AddressWithPort, 11);
+  RUN_TEST(test_IPv6AddressWithPort, 18);
+  RUN_TEST(test_ScopedIPv6AddressWithPort, 42);
+  RUN_TEST(test_HashEqual, 67);
+  RUN_TEST(test_HashNotEqual, 75);
+  RUN_TEST(test_IgnoreIPv6Fields, 88);
 
   return (UnityEnd());
 }
index 565470a300ba45484416cc08f4e382a97276d7c7..452a60a9a62cd5946f800465880e4ceaa5eb5ebf 100644 (file)
@@ -49,11 +49,11 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "ssl_init.c";
   UnityBegin("ssl_init.c");
-  RUN_TEST(test_MD5KeyTypeWithoutDigestLength, 18);
-  RUN_TEST(test_MD5KeyTypeWithDigestLength, 22);
-  RUN_TEST(test_SHA1KeyTypeWithDigestLength, 31);
-  RUN_TEST(test_MD5KeyName, 46);
-  RUN_TEST(test_SHA1KeyName, 50);
+  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);
 
   return (UnityEnd());
 }
index c69880026573321088dc66a04faa8126bb688f9e..0a2912bee0cb166cecc8b90e92cbdf7721bcf55e 100644 (file)
@@ -51,13 +51,13 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "strtolfp.c";
   UnityBegin("strtolfp.c");
-  RUN_TEST(test_PositiveInteger, 9);
-  RUN_TEST(test_NegativeInteger, 23);
-  RUN_TEST(test_PositiveFraction, 40);
-  RUN_TEST(test_NegativeFraction, 54);
-  RUN_TEST(test_PositiveMsFraction, 71);
-  RUN_TEST(test_NegativeMsFraction, 87);
-  RUN_TEST(test_InvalidChars, 105);
+  RUN_TEST(test_PositiveInteger, 11);
+  RUN_TEST(test_NegativeInteger, 25);
+  RUN_TEST(test_PositiveFraction, 42);
+  RUN_TEST(test_NegativeFraction, 56);
+  RUN_TEST(test_PositiveMsFraction, 73);
+  RUN_TEST(test_NegativeMsFraction, 89);
+  RUN_TEST(test_InvalidChars, 107);
 
   return (UnityEnd());
 }
index ee291ab527bf32c90bf4a24896a3b7f872576163..b56e7560f636cfeb29ec0894da2a5286902043ae 100644 (file)
@@ -72,34 +72,34 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "timespecops.c";
   UnityBegin("timespecops.c");
-  RUN_TEST(test_Helpers1, 156);
-  RUN_TEST(test_Normalise, 176);
-  RUN_TEST(test_SignNoFrac, 190);
-  RUN_TEST(test_SignWithFrac, 202);
-  RUN_TEST(test_CmpFracEQ, 216);
-  RUN_TEST(test_CmpFracGT, 229);
-  RUN_TEST(test_CmpFracLT, 242);
-  RUN_TEST(test_AddFullNorm, 259);
-  RUN_TEST(test_AddFullOflow1, 273);
-  RUN_TEST(test_AddNsecNorm, 287);
-  RUN_TEST(test_AddNsecOflow1, 299);
-  RUN_TEST(test_SubFullNorm, 315);
-  RUN_TEST(test_SubFullOflow, 329);
-  RUN_TEST(test_SubNsecNorm, 343);
-  RUN_TEST(test_SubNsecOflow, 355);
-  RUN_TEST(test_Neg, 371);
-  RUN_TEST(test_AbsNoFrac, 388);
-  RUN_TEST(test_AbsWithFrac, 399);
-  RUN_TEST(test_Helpers2, 414);
-  RUN_TEST(test_ToLFPbittest, 446);
-  RUN_TEST(test_ToLFPrelPos, 459);
-  RUN_TEST(test_ToLFPrelNeg, 471);
-  RUN_TEST(test_ToLFPabs, 483);
-  RUN_TEST(test_FromLFPbittest, 498);
-  RUN_TEST(test_FromLFPrelPos, 517);
-  RUN_TEST(test_FromLFPrelNeg, 530);
-  RUN_TEST(test_LFProundtrip, 545);
-  RUN_TEST(test_ToString, 564);
+  RUN_TEST(test_Helpers1, 155);
+  RUN_TEST(test_Normalise, 175);
+  RUN_TEST(test_SignNoFrac, 189);
+  RUN_TEST(test_SignWithFrac, 201);
+  RUN_TEST(test_CmpFracEQ, 215);
+  RUN_TEST(test_CmpFracGT, 228);
+  RUN_TEST(test_CmpFracLT, 241);
+  RUN_TEST(test_AddFullNorm, 258);
+  RUN_TEST(test_AddFullOflow1, 272);
+  RUN_TEST(test_AddNsecNorm, 286);
+  RUN_TEST(test_AddNsecOflow1, 298);
+  RUN_TEST(test_SubFullNorm, 314);
+  RUN_TEST(test_SubFullOflow, 328);
+  RUN_TEST(test_SubNsecNorm, 342);
+  RUN_TEST(test_SubNsecOflow, 354);
+  RUN_TEST(test_Neg, 370);
+  RUN_TEST(test_AbsNoFrac, 387);
+  RUN_TEST(test_AbsWithFrac, 398);
+  RUN_TEST(test_Helpers2, 413);
+  RUN_TEST(test_ToLFPbittest, 445);
+  RUN_TEST(test_ToLFPrelPos, 458);
+  RUN_TEST(test_ToLFPrelNeg, 470);
+  RUN_TEST(test_ToLFPabs, 482);
+  RUN_TEST(test_FromLFPbittest, 497);
+  RUN_TEST(test_FromLFPrelPos, 516);
+  RUN_TEST(test_FromLFPrelNeg, 529);
+  RUN_TEST(test_LFProundtrip, 544);
+  RUN_TEST(test_ToString, 563);
 
   return (UnityEnd());
 }
index 03ab64e877c275f801001414f0f2750a235240f4..013aae1f2a52ec5f297947d95dee3a34aff223b5 100644 (file)
@@ -72,34 +72,34 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "timevalops.c";
   UnityBegin("timevalops.c");
-  RUN_TEST(test_Helpers1, 155);
-  RUN_TEST(test_Normalise, 175);
-  RUN_TEST(test_SignNoFrac, 189);
-  RUN_TEST(test_SignWithFrac, 201);
-  RUN_TEST(test_CmpFracEQ, 216);
-  RUN_TEST(test_CmpFracGT, 230);
-  RUN_TEST(test_CmpFracLT, 244);
-  RUN_TEST(test_AddFullNorm, 262);
-  RUN_TEST(test_AddFullOflow1, 276);
-  RUN_TEST(test_AddUsecNorm, 290);
-  RUN_TEST(test_AddUsecOflow1, 302);
-  RUN_TEST(test_SubFullNorm, 318);
-  RUN_TEST(test_SubFullOflow, 332);
-  RUN_TEST(test_SubUsecNorm, 346);
-  RUN_TEST(test_SubUsecOflow, 358);
-  RUN_TEST(test_Neg, 374);
-  RUN_TEST(test_AbsNoFrac, 391);
-  RUN_TEST(test_AbsWithFrac, 402);
-  RUN_TEST(test_Helpers2, 418);
-  RUN_TEST(test_ToLFPbittest, 451);
-  RUN_TEST(test_ToLFPrelPos, 466);
-  RUN_TEST(test_ToLFPrelNeg, 480);
-  RUN_TEST(test_ToLFPabs, 493);
-  RUN_TEST(test_FromLFPbittest, 511);
-  RUN_TEST(test_FromLFPrelPos, 529);
-  RUN_TEST(test_FromLFPrelNeg, 542);
-  RUN_TEST(test_LFProundtrip, 556);
-  RUN_TEST(test_ToString, 575);
+  RUN_TEST(test_Helpers1, 153);
+  RUN_TEST(test_Normalise, 173);
+  RUN_TEST(test_SignNoFrac, 187);
+  RUN_TEST(test_SignWithFrac, 199);
+  RUN_TEST(test_CmpFracEQ, 214);
+  RUN_TEST(test_CmpFracGT, 228);
+  RUN_TEST(test_CmpFracLT, 242);
+  RUN_TEST(test_AddFullNorm, 260);
+  RUN_TEST(test_AddFullOflow1, 274);
+  RUN_TEST(test_AddUsecNorm, 288);
+  RUN_TEST(test_AddUsecOflow1, 300);
+  RUN_TEST(test_SubFullNorm, 316);
+  RUN_TEST(test_SubFullOflow, 330);
+  RUN_TEST(test_SubUsecNorm, 344);
+  RUN_TEST(test_SubUsecOflow, 356);
+  RUN_TEST(test_Neg, 372);
+  RUN_TEST(test_AbsNoFrac, 389);
+  RUN_TEST(test_AbsWithFrac, 400);
+  RUN_TEST(test_Helpers2, 416);
+  RUN_TEST(test_ToLFPbittest, 449);
+  RUN_TEST(test_ToLFPrelPos, 464);
+  RUN_TEST(test_ToLFPrelNeg, 478);
+  RUN_TEST(test_ToLFPabs, 491);
+  RUN_TEST(test_FromLFPbittest, 509);
+  RUN_TEST(test_FromLFPrelPos, 527);
+  RUN_TEST(test_FromLFPrelNeg, 540);
+  RUN_TEST(test_LFProundtrip, 554);
+  RUN_TEST(test_ToString, 573);
 
   return (UnityEnd());
 }
index 34807b31973e5feca6fdb8758ff28800bef39bb3..cf7dd1794a66cd7630e03d78b7cce0ec1e33c4b1 100644 (file)
@@ -47,9 +47,9 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "tstotv.c";
   UnityBegin("tstotv.c");
-  RUN_TEST(test_Seconds, 7);
-  RUN_TEST(test_MicrosecondsExact, 19);
-  RUN_TEST(test_MicrosecondsRounding, 33);
+  RUN_TEST(test_Seconds, 9);
+  RUN_TEST(test_MicrosecondsExact, 21);
+  RUN_TEST(test_MicrosecondsRounding, 35);
 
   return (UnityEnd());
 }
index 0aa987afcf2b80345164ac4fd230911f741377a1..468aae5e09ec6f4a8fd1d36177ac9fea3bbaac9e 100644 (file)
@@ -47,9 +47,9 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "tvtots.c";
   UnityBegin("tvtots.c");
-  RUN_TEST(test_Seconds, 9);
-  RUN_TEST(test_MicrosecondsRounded, 20);
-  RUN_TEST(test_MicrosecondsExact, 35);
+  RUN_TEST(test_Seconds, 10);
+  RUN_TEST(test_MicrosecondsRounded, 21);
+  RUN_TEST(test_MicrosecondsExact, 36);
 
   return (UnityEnd());
 }
index aef5216d8cd42034ed5143c5b0317400f207ffd6..4e67713638cf315cdaaa21d384c214bb752fcbef 100644 (file)
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
   progname = argv[0];
   Unity.TestFile = "uglydate.c";
   UnityBegin("uglydate.c");
-  RUN_TEST(test_ConstantDateTime, 10);
+  RUN_TEST(test_ConstantDateTime, 11);
 
   return (UnityEnd());
 }
index fd3e4af8219e1a60e8118dfcc4b5bd5075932de1..f9a9fde41ee8f94a8f095d288c8fa5252035163e 100644 (file)
@@ -1,59 +1,57 @@
 #ifndef TESTS_SOCKADDRTEST_H
 #define TESTS_SOCKADDRTEST_H
 
-#include "libntptest.h"
-
-extern "C" {
 #include "ntp.h"
-};
-
-class sockaddrtest : public libntptest {
-protected:
-       ::testing::AssertionResult IsEqual(const sockaddr_u &expected, const sockaddr_u &actual) {
-               if (expected.sa.sa_family != actual.sa.sa_family) {
-                       return ::testing::AssertionFailure()
-                               << "Expected sa_family: " << expected.sa.sa_family
-                               << " but got: " << actual.sa.sa_family;
-               }
+#include "ntp_stdlib.h"
 
-               if (actual.sa.sa_family == AF_INET) { // IPv4
-                       if (expected.sa4.sin_port == actual.sa4.sin_port &&
-                               memcmp(&expected.sa4.sin_addr, &actual.sa4.sin_addr,
-                                          sizeof(in_addr)) == 0) {
-                               return ::testing::AssertionSuccess();
-                       } else {
-                               return ::testing::AssertionFailure()
-                                       << "IPv4 comparision failed, expected: "
-                                       << expected.sa4.sin_addr.s_addr
-                                       << "(" << socktoa(&expected) << ")"
-                                       << " but was: "
-                                       << actual.sa4.sin_addr.s_addr
-                                       << "(" << socktoa(&actual) << ")";
-                       }
-               } else if (actual.sa.sa_family == AF_INET6) { //IPv6
-                       if (expected.sa6.sin6_port == actual.sa6.sin6_port &&
-                               memcmp(&expected.sa6.sin6_addr, &actual.sa6.sin6_addr,
-                                          sizeof(in6_addr)) == 0) {
-                               return ::testing::AssertionSuccess();
-                       } else {
-                               return ::testing::AssertionFailure()
-                                       << "IPv6 comparision failed";
-                       }
-               } else { // Unknown family
-                       return ::testing::AssertionFailure()
-                               << "Unknown sa_family: " << actual.sa.sa_family;
-               }
-       }
+sockaddr_u CreateSockaddr4(const char* address, unsigned int port) {
+       sockaddr_u s;
+       s.sa4.sin_family = AF_INET;
+       s.sa4.sin_addr.s_addr = inet_addr(address);
+       SET_PORT(&s, port);
+
+       return s;
+}
+
+int IsEqual(const sockaddr_u expected, const sockaddr_u actual) {
+       struct in_addr in;
+       struct in6_addr in6;
 
-       sockaddr_u CreateSockaddr4(const char* address, unsigned int port) {
-               sockaddr_u s;
-               s.sa4.sin_family = AF_INET;
-               s.sa4.sin_addr.s_addr = inet_addr(address);
-               SET_PORT(&s, port);
+       if (expected.sa.sa_family != actual.sa.sa_family) {
+               //<< "Expected sa_family: " << expected.sa.sa_family
+               //<< " but got: " << actual.sa.sa_family;
+               return FALSE;
+       }
 
-               return s;
+       if (actual.sa.sa_family == AF_INET) { // IPv4
+               if (expected.sa4.sin_port == actual.sa4.sin_port &&
+                       memcmp(&expected.sa4.sin_addr, &actual.sa4.sin_addr,
+                                  sizeof( in )) == 0) {
+                       return TRUE;
+               } else {
+                       //<< "IPv4 comparision failed, expected: "
+                       //<< expected.sa4.sin_addr.s_addr
+                       //<< "(" << socktoa(&expected) << ") but was: "
+                       //<< actual.sa4.sin_addr.s_addr "(" << socktoa(&actual) << ")";
+                       return FALSE;
+               }
+       } else if (actual.sa.sa_family == AF_INET6) { //IPv6
+               if (expected.sa6.sin6_port == actual.sa6.sin6_port &&
+                       memcmp(&expected.sa6.sin6_addr, &actual.sa6.sin6_addr,
+                                  sizeof(in6)) == 0) {
+                       return TRUE;
+               } else {
+                       printf("IPv6 comparision failed");
+                       return FALSE;
+               }
+       } else { // Unknown family
+               printf("Unknown sa_family: ");// << actual.sa.sa_family;
+               return FALSE;
        }
-};
+}
+
 
 #endif // TESTS_SOCKADDRTEST_H
 
+
+
index e6f76a5f5f90b908fe6ef58e826c4d35cd14150a..537df1e44407ddd8cad5d7f48d7ec2381563853b 100644 (file)
@@ -1,9 +1,11 @@
 #include "config.h"
+
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
+
 #include "unity.h"
 
-#include "c_sockaddrtest.h"
+#include "sockaddrtest.h"
 
 
 void test_IPv4AddressWithPort(void) {
index e8c37f58839fc2ba57686e57693238ba4c2803a5..fe22414e3339bd7f4951a71e8fd669070d897054 100644 (file)
@@ -1,11 +1,12 @@
 #include "config.h"
 
+#include "ntp.h"
+
 #ifdef OPENSSL
 # include "openssl/err.h"
 # include "openssl/rand.h"
 # include "openssl/evp.h"
 #endif
-#include "ntp.h"
 
 #include "unity.h"
 
index d328244cfdf24f11aedda9bee20e66dce34e57dc..de9f1119c6a10fcfb06849afb55d9816341e8ca1 100644 (file)
@@ -1,8 +1,10 @@
 #include "config.h"
+
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
+
 #include "unity.h"
-#include "c_lfptest.h"
+#include "lfptest.h"
 
 /* This file tests both atolfp and mstolfp */
 
index 3e50e8e8fdc5de540b03368fdcdc839897706935..e489f673fc7654391e9a7c710f9c1b4f5319378f 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
+
 #include "test-libntp.h"
 
 //const char *progname = "test-libntp";
index bd4c681acc27925743acb5b73c4bc2f702efe913..c4aeef28bae2c0e4c5e035a316b734e60ea2525a 100644 (file)
@@ -1,11 +1,8 @@
-//#include "tests_main.h"
 #include "config.h"
 
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
 
-//u_long current_time = 4; // needed by authkeys. Used only in to calculate lifetime.
-//const char *progname = "libntptest";
 
 static time_t timefunc(time_t*);
 static time_t nowtime;
index 3590733d0d229e373a532a3ad8ed603af727281f..bb2619a079af1f51dc7feb68a93d8c4ae66af908 100644 (file)
@@ -1,5 +1,4 @@
 #include "config.h"
-//#include "c_timestructs.h"
 
 #include "ntp_types.h"
 #include "ntp_fp.h"
index 7bc4ffdcf8caada13fc23288abf706a2c1dcef67..8cd59270d7939ede8dc2ccbd476c5ab7f4ce31a2 100644 (file)
  * HRVs (human readable values) but we might also be interested in the
  * machine representation for diagnostic purposes.
  */
+
+
+//#ifndef TESTCALSHIMS_H
+#include "testcalshims.h"
+//#endif
+
+
 #ifndef TIMESTRUCTS_H
 #define TIMESTRUCTS_H
 
-extern "C" {
 #include "ntp_fp.h"
-}
 
-namespace timeStruct {
+
+l_fp test ; 
+//namespace timeStruct {
 
 // wrap a l_fp struct with common operations
-class l_fp_wrap {
-  public:
+struct l_fp_wrap {
+  
        l_fp V;
        
-       l_fp_wrap()
-               { ZERO(V); }
-       l_fp_wrap(u_int32 hi, u_int32 lo)
-               { V.l_ui = hi; V.l_uf = lo; }
-       l_fp_wrap(const l_fp &rhs)
-               { V = rhs; }
-       bool operator == (const l_fp_wrap& rhs) const
-               { return L_ISEQU(&V, &rhs.V); }
-       operator l_fp* () 
-               { return &V; }
-       operator l_fp& ()
-               { return V; }
+       
+       //bool operator == (const l_fp_wrap& rhs) const
+       //      { return L_ISEQU(&V, &rhs.V); }
+
+//---------------THIS HAS TO BE MANUALLY CONVERTED IN CODE!!!
+       //operator l_fp* () 
+       //      { return &V; }
+       //operator l_fp& ()
+       //      { return V; }
+//-----------------------------------------
+/*
        l_fp_wrap & operator = (const l_fp_wrap& rhs)
                { V = rhs.V; return *this; }
        l_fp_wrap& operator = (const l_fp& rhs)
                { V = rhs; return *this; }
-       };
+*/
+};
+
+l_fp_wrap(l_fp V){
+       ZERO(V); }
+l_fp_wrap(l_fp V, u_int32 hi, u_int32 lo){
+       V.l_ui = hi; V.l_uf = lo; }
+l_fp_wrap(l_fp V, const l_fp &rhs){
+       V = rhs; }
+
+l_fp_wrap_equals(const l_fp_wrap& current, const l_fp_wrap& rhs) const // operator ==
+       { return L_ISEQU(&current.V, &rhs.V); }
+
+l_fp_wrap_and(const l_fp_wrap& current, const l_fp_wrap& rhs){
+       V = rhs.V; 
+       return current//*this;
+}
+l_fp_wrap_and(const l_fp& current, const l_fp& rhs){ 
+       V = rhs; 
+       return current//*this; 
+}
+
        
+
 // wrap a 'struct timeval' with common operations
-class timeval_wrap {
-public:
+struct timeval_wrap {
+
        struct timeval V;
 
        timeval_wrap()
@@ -74,8 +102,8 @@ public:
 };
 
 // wrap a 'struct timespec' with common operations
-class timespec_wrap {
-public:
+struct timespec_wrap {
+
        struct timespec V;
 
        timespec_wrap()
@@ -180,6 +208,6 @@ extern std::ostream& operator << (std::ostream& os,
 extern std::ostream& operator << (std::ostream& os,
                                  const timeStruct::timespec_wrap& val);
 
-} // namespace timeStruct
+//} // namespace timeStruct
 
 #endif // TIMESTRUCTS_H
index e8e167ea2062db88b6314a8466f63df7bcd6fa07..080dfb737d175a14d09c98e384e9920376637c1e 100644 (file)
@@ -1,17 +1,15 @@
 #include "config.h"
 
-//#include "c_timestructs.h" //functions removed from the wrapper and placed directly here! 
 //some unused features are still in the wrapper, unconverted
 
-#include "unity.h"
-
 #include "ntp_types.h"
 #include "ntp_fp.h"
 
 #include <math.h>
 #include "timevalops.h"
 
-#include <string.h>
+#include "unity.h"
+
 
 //in unity_helper.h :
 #define TEST_ASSERT_EQUAL_timeval(a, b) { \
index 87f6ad7b826792641099ed6ef92ce46b5d092f2b..080172752fda842381ed3c3f11ad1d5933af9cb5 100644 (file)
@@ -1,6 +1,8 @@
 #include "config.h"
+
 #include "ntp_fp.h"
 #include "timevalops.h"
+
 #include "unity.h"
 
 void
@@ -39,4 +41,4 @@ test_MicrosecondsRounding(void) {
 
        TEST_ASSERT_EQUAL(expected.tv_sec, actual.tv_sec);
        TEST_ASSERT_EQUAL(expected.tv_usec, actual.tv_usec);
-}
\ No newline at end of file
+}
index 2f311f55b817b3891b565c86a4459a6da396f09c..6c8345aaaa1b459d46d099c14e35c5a7696837de 100644 (file)
@@ -1,11 +1,12 @@
 #include "config.h"
-#include "c_lfptest.h"
+
+#include "lfptest.h"
 #include "timevalops.h"
+
 #include "unity.h"
 #include <math.h>// Required on Solaris for ldexp.
 
 
-
 void test_Seconds(void)
 {
        struct timeval input = {500, 0}; // 500.0 s
index a087da6010908e033fb8e4cb8f3c1297a0379ff4..a8d02d15b910b4eb58a86b516e3da234306ac5b5 100644 (file)
@@ -3,6 +3,7 @@
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
 #include "ntp_fp.h"
+
 #include "unity.h"
 
 
index ff5e57820181223fc47f82a25a90ee3dde06a112..af7dd1b7bfeb3cff6e5f7b2267bc0c3c41777ee9 100644 (file)
@@ -1,11 +1,11 @@
 #include "config.h"
 
 #include "ntp_stdlib.h"
-//#include "ntp_calendar.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) {