]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Unity test cleanup. Harlan Stenn.
authorHarlan Stenn <stenn@ntp.org>
Sat, 21 Nov 2015 03:41:16 +0000 (19:41 -0800)
committerHarlan Stenn <stenn@ntp.org>
Sat, 21 Nov 2015 03:41:16 +0000 (19:41 -0800)
bk: 564fe7dcvh1AAb7d9IXajTc0ULNblw

48 files changed:
sntp/tests/kodDatabase.c
sntp/tests/kodFile.c
sntp/tests/run-kodDatabase.c
sntp/tests/run-t-log.c
sntp/tests/t-log.c
tests/libntp/calendar.c
tests/libntp/caljulian.c
tests/libntp/decodenetnum.c
tests/libntp/humandate.c
tests/libntp/lfptostr.c
tests/libntp/modetoa.c
tests/libntp/msyslog.c
tests/libntp/netof.c
tests/libntp/numtoa.c
tests/libntp/numtohost.c
tests/libntp/prettydate.c
tests/libntp/recvbuff.c
tests/libntp/refidsmear.c
tests/libntp/refnumtoa.c
tests/libntp/run-calendar.c
tests/libntp/run-decodenetnum.c
tests/libntp/run-humandate.c
tests/libntp/run-lfptostr.c
tests/libntp/run-modetoa.c
tests/libntp/run-msyslog.c
tests/libntp/run-netof.c
tests/libntp/run-numtoa.c
tests/libntp/run-numtohost.c
tests/libntp/run-prettydate.c
tests/libntp/run-refidsmear.c
tests/libntp/run-refnumtoa.c
tests/libntp/run-sfptostr.c
tests/libntp/run-socktoa.c
tests/libntp/run-statestr.c
tests/libntp/run-strtolfp.c
tests/libntp/run-timespecops.c
tests/libntp/run-timevalops.c
tests/libntp/run-uglydate.c
tests/libntp/sfptostr.c
tests/libntp/socktoa.c
tests/libntp/statestr.c
tests/libntp/strtolfp.c
tests/libntp/timespecops.c
tests/libntp/timevalops.c
tests/libntp/uglydate.c
tests/sandbox/run-uglydate.c
tests/sandbox/smeartest.c
tests/sandbox/uglydate.c

index 0c3615d0eae848df43a104ec14846809511c84c4..741a243460a771aa7bbb2f2f13c44262a82bb800 100644 (file)
@@ -1,5 +1,6 @@
 #include "config.h"
 
+#include "ntp_workimpl.h"
 #include "ntp_types.h"
 #include "sntptest.h"
 #include "ntp_stdlib.h"
@@ -9,6 +10,10 @@
 
 #include "unity.h"
 
+#ifndef WORK_FORK
+#include "GRONK: no WORK_FORK"
+#endif
+
 void setUp(void);
 void test_SingleEntryHandling(void);
 void test_MultipleEntryHandling(void);
@@ -20,6 +25,7 @@ void test_DeleteEntry(void);
 void
 setUp(void) {
        kod_init_kod_db("/dev/null", TRUE);
+       init_lib();
 }
 
 
index 6eb0971a996c9dab706cba0e9620e2d055c09fb3..f99d8cf2084cc5405077143caa145294e9ce2314 100644 (file)
@@ -28,6 +28,7 @@ void
 setUp(void) {
        kod_db_cnt = 0;
        kod_db = NULL;
+       init_lib();
 }
 
 
index e5bf3d728e12f1f22826fe0569e8f331b6cfe3b5..df6d808531975ca4492cce8c789ef5d38f039157 100644 (file)
@@ -23,6 +23,7 @@
 #include <setjmp.h>
 #include <stdio.h>
 #include "config.h"
+#include "ntp_workimpl.h"
 #include "ntp_types.h"
 #include "sntptest.h"
 #include "ntp_stdlib.h"
@@ -56,11 +57,11 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("kodDatabase.c");
-  RUN_TEST(test_SingleEntryHandling, 13);
-  RUN_TEST(test_MultipleEntryHandling, 14);
-  RUN_TEST(test_NoMatchInSearch, 15);
-  RUN_TEST(test_AddDuplicate, 16);
-  RUN_TEST(test_DeleteEntry, 17);
+  RUN_TEST(test_SingleEntryHandling, 18);
+  RUN_TEST(test_MultipleEntryHandling, 19);
+  RUN_TEST(test_NoMatchInSearch, 20);
+  RUN_TEST(test_AddDuplicate, 21);
+  RUN_TEST(test_DeleteEntry, 22);
 
   return (UnityEnd());
 }
index e6ec758b1bfd7330e30fa1c7fae2ffaa97ce332c..8d1234570f6880027da12ca93c8b13e409449aaf 100644 (file)
@@ -49,9 +49,9 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("t-log.c");
-  RUN_TEST(testChangePrognameInMysyslog, 9);
-  RUN_TEST(testOpenLogfileTest, 10);
-  RUN_TEST(testWriteInCustomLogfile, 11);
+  RUN_TEST(testChangePrognameInMysyslog, 10);
+  RUN_TEST(testOpenLogfileTest, 11);
+  RUN_TEST(testWriteInCustomLogfile, 12);
 
   return (UnityEnd());
 }
index fd508e445098c3a45f67519c006add1a77764720..6975b1a21034a366ce92059b49ceb32853fc1c76 100644 (file)
@@ -6,34 +6,50 @@
 //#include "log.h"
 #include "log.c"
 
+void setUp(void);
 void testChangePrognameInMysyslog(void);
 void testOpenLogfileTest(void);
 void testWriteInCustomLogfile(void);
 
 
+void
+setUp(void) {
+       init_lib();
+}
+
+
 //in var/log/syslog (may differ depending on your OS), logged name of the program will be "TEST_PROGNAME".
 
-void testChangePrognameInMysyslog(void){
+void
+testChangePrognameInMysyslog(void)
+{
        sntp_init_logging("TEST_PROGNAME");
-       msyslog(LOG_ERR, "TESTING sntp_init_logging()"); //%m will print the last errno?
+       msyslog(LOG_ERR, "TESTING sntp_init_logging()");
+
+       return;
 }
 
 //writes log files in your own file instead of syslog! (MAY BE USEFUL TO SUPPRESS ERROR MESSAGES!)
 
-void testOpenLogfileTest(void){
+void
+testOpenLogfileTest(void)
+{
        sntp_init_logging("TEST_PROGNAME2"); //this name is consistent through the entire program unless changed
-       open_logfile("testLogfile.log"); 
+       open_logfile("testLogfile.log");
        //open_logfile("/var/log/syslog"); //this gives me "Permission Denied" when i do %m
-       
+
        msyslog(LOG_ERR, "Cannot open log file %s","abcXX");
        //cleanup_log(); //unnecessary  after log.c fix!
-       
+
+       return;
 }
 
 
 //multiple cleanup_log() causes segfault. Probably the reason it's static. Opening multiple open_logfile(name) will cause segfault x.x I'm guessing it's not intended to be changed. Cleanup after unity test doesn't fix it, looks like. Calling in tearDown() also causes issues.
 
-void testWriteInCustomLogfile(void){
+void
+testWriteInCustomLogfile(void)
+{
        char testString[256] = "12345 ABC";
        char testName[256] = "TEST_PROGNAME3";
 
@@ -43,27 +59,27 @@ void testWriteInCustomLogfile(void){
        open_logfile("testLogfile2.log"); // ./ causing issues
        //sntp_init_logging(testName);
 
-       
+
        msyslog(LOG_ERR, "%s", testString);
        FILE * f = fopen("testLogfile2.log","r");
        char line[256];
 
        //should be only 1 line
-       while (fgets(line, sizeof(line), f)) {
-               printf("%s", line); 
-       }
-       
+       while (fgets(line, sizeof(line), f)) {
+               printf("%s", line);
+       }
+
 
        char* x = strstr(line,testName);
-       
+
        TEST_ASSERT_TRUE( x != NULL);
 
        x = strstr(line,testString);
        TEST_ASSERT_TRUE( x != NULL);
        //cleanup_log();
-       fclose(f); //using this will also cause segfault, because at the end, log.c will  call (using atexit(func) function) cleanup_log(void)-> fclose(syslog_file); 
+       fclose(f); //using this will also cause segfault, because at the end, log.c will  call (using atexit(func) function) cleanup_log(void)-> fclose(syslog_file);
        //After the 1st fclose, syslog_file = NULL, and is never reset -> hopefully fixed by editing log.c
        //TEST_ASSERT_EQUAL_STRING(testString,line); //doesn't work, line is dynamic because the process name is random.
-}
-
 
+       return;
+}
index 87619802dffc207ab10c7d51c7c89258cf59ed86..0aff0e699c435d4d11f9b9d6a5bed15a89c7e279 100644 (file)
@@ -8,6 +8,7 @@
 
 static int leapdays(int year);
 
+void   setUp(void);
 int    isGT(int first, int second);
 int    leapdays(int year);
 char * CalendarFromCalToString(const struct calendar *cal);
@@ -34,6 +35,16 @@ void test_IsoCalWeeksToYearStart(void);
 void   test_IsoCalWeeksToYearEnd(void);
 void   test_DaySecToDate(void);
 
+
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 /*
  * ---------------------------------------------------------------------
  * test support stuff
index f1eb3538d5cc7d1845712874bb8be9dbb9158710..30ceaaec0605d56df10b63dfbb3c46d3d828e904 100644 (file)
@@ -72,6 +72,7 @@ setUp()
 {
     ntpcal_set_timefunc(timefunc);
     settime(1970, 1, 1, 0, 0, 0);
+    init_lib();
 
     return;
 }
index 0e9bc34922b7de51273c9a8d8308070cd2991289..0d2b0b54e04b9b345f97a343f6ef75914b0c86e7 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "unity.h"
 
+void setUp(void);
 extern void test_IPv4AddressOnly(void);
 extern void test_IPv4AddressWithPort(void);
 //#ifdef ISC_PLATFORM_HAVEIPV6
@@ -14,6 +15,15 @@ extern void test_IllegalAddress(void);
 extern void test_IllegalCharInPort(void);
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void
 test_IPv4AddressOnly(void) {
        const char *str = "192.0.2.1";
index 31758c187ec8f18f15f07f89fefa5a834af56eae..de3c751c86a12b679769dfa7a6a815efff16a86f 100644 (file)
@@ -5,10 +5,20 @@
 
 #include "unity.h"
 
+void setUp(void);
 void test_RegularTime(void);
 void test_CurrentTime(void);
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void
 test_RegularTime(void)
 {
index 142e6c772ebb4b15afb6dd976b2a969e5a799152..ed3285378d7eab6de958a533b878d1a8536b5cc5 100644 (file)
@@ -20,6 +20,7 @@ static const int HALF_PROMILLE_UP = 2147484; /* slightly more than 0.0005 */
 static const int HALF_PROMILLE_DOWN = 2147483; /* slightly less than 0.0005 */
 
 
+void setUp(void);
 void test_PositiveInteger(void);
 void test_NegativeInteger(void);
 void test_PositiveIntegerWithFraction(void);
@@ -33,6 +34,14 @@ void test_MillisecondsRoundingDown(void);
 void test_UnsignedInteger(void);
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
 
 void
 test_PositiveInteger(void) {
index 267b44e010a7a23002354f72593353d1ccfc3a7c..03b384c1d350b4b5de1d6e02441b7d94c4bfb19e 100644 (file)
@@ -4,10 +4,20 @@
 
 #include "unity.h"
 
+void setUp(void);
 void test_KnownMode(void);
 void test_UnknownMode(void);
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void
 test_KnownMode(void) {
        const int MODE = 3; // Should be "client"
index dec8d859269822ede1df82d3f9be0ff2bb0228dc..987c814253304b0f36d2a48fa116f105e293857b 100644 (file)
@@ -10,6 +10,7 @@ void format_errmsg(char *, size_t, const char *, int);
 #endif
 
 
+void setUp(void);
 void test_msnprintf(void);
 void test_msnprintfLiteralPercentm(void);
 void test_msnprintfBackslashLiteralPercentm(void);
@@ -20,6 +21,15 @@ void test_msnprintfNullTarget(void);
 void test_msnprintfTruncate(void);
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void
 test_msnprintf(void) {
 #define FMT_PREFIX "msyslog.cpp ENOENT: "
index dc0e5a20096b9d0a9c2d41bdbc5750ea2f0b2b5d..59dd7098d2a746c53fa665ecfa7ffbcd70e7c843 100644 (file)
@@ -8,12 +8,22 @@
 #include "sockaddrtest.h"
 
 
+void setUp(void);
 void test_ClassBAddress(void);
 void test_ClassCAddress(void);
 void test_ClassAAddress(void);
 void test_IPv6Address(void);
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void
 test_ClassBAddress(void)
 {
index 5c7a663f4a21e51add027a4eedb6d8a1fc326046..42638b62836ab3d14a322cab776259b7bcb1a3e8 100644 (file)
@@ -5,9 +5,20 @@
 
 #include "unity.h"
 
+void setUp(void);
 void test_Address(void);
 void test_Netmask(void);
 
+
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void
 test_Address(void) {
        const u_int32 input = htonl(3221225472UL + 512UL + 1UL); // 192.0.2.1
index 4eb32eec58a5c1339c5ae190fe66e894c95b8c1f..1c095eb55cdd8aaa76f34a2eb32c3bfaf2e18cf5 100644 (file)
@@ -5,8 +5,19 @@
 
 #include "unity.h"
 
+void setUp(void);
 void test_LoopbackNetNonResolve(void);
 
+
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void
 test_LoopbackNetNonResolve(void) {
        /* A loopback address in 127.0.0.0/8 is chosen, and
index 981e14699a42f10e063db01ae8327fb755a298be..c940e2a2dd99229bd1eb861157707d63324cb076 100644 (file)
@@ -6,9 +6,19 @@
 
 #include "unity.h"
 
+void setUp(void);
 void test_ConstantDate(void);
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void
 test_ConstantDate(void) {
        const u_int32 HALF = 2147483648UL;
index b9299d2e4d5915f18bb6e21c2ff69d0da59dec2a..6c089bb4c33f821b9a9ae5b4ccca8c1f4a0aa38e 100644 (file)
@@ -13,6 +13,9 @@ void
 setUp(void)
 {
        init_recvbuff(RECV_INIT);
+       init_lib();
+
+       return;
 }
 
 void
index ad431c1a1b213e254a64467f18b9914c9c21e5e4..da1ebff200ee661b473854abaf03433391a33faf 100644 (file)
  */
 
 
+void setUp(void);
 void rtol(uint32_t r, char *es);
 void rtoltor(uint32_t er, char *es);
 void ltor(l_fp l, char *er);
 void test_refidsmear(void);
 
+
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
 void
 rtol(uint32_t r, char *es)
 {
index 8fe71045ee1aac2ff15bbc9bec95b8db5d38b650..9db5fb11d999a2c82dc11f1924ae40a699b5beac 100644 (file)
@@ -9,10 +9,20 @@
 /* Might need to be updated if a new refclock gets this id. */
 static const int UNUSED_REFCLOCK_ID = 250;
 
+void setUp(void);
 void test_LocalClock(void);
 void test_UnknownId(void);
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void
 test_LocalClock(void) {
 #ifdef REFCLOCK                /* clockname() is useless otherwise */
index 50c5b201491c2dc94917a59f903a095b6b780964..555f3ba6d67cdfd1d5184a31aa0cb3fcf0c319c2 100644 (file)
@@ -63,21 +63,21 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("calendar.c");
-  RUN_TEST(test_DaySplitMerge, 21);
-  RUN_TEST(test_SplitYearDays1, 22);
-  RUN_TEST(test_SplitYearDays2, 23);
-  RUN_TEST(test_RataDie1, 24);
-  RUN_TEST(test_LeapYears1, 25);
-  RUN_TEST(test_LeapYears2, 26);
-  RUN_TEST(test_RoundTripDate, 27);
-  RUN_TEST(test_RoundTripYearStart, 28);
-  RUN_TEST(test_RoundTripMonthStart, 29);
-  RUN_TEST(test_RoundTripWeekStart, 30);
-  RUN_TEST(test_RoundTripDayStart, 31);
-  RUN_TEST(test_IsoCalYearsToWeeks, 32);
-  RUN_TEST(test_IsoCalWeeksToYearStart, 33);
-  RUN_TEST(test_IsoCalWeeksToYearEnd, 34);
-  RUN_TEST(test_DaySecToDate, 35);
+  RUN_TEST(test_DaySplitMerge, 22);
+  RUN_TEST(test_SplitYearDays1, 23);
+  RUN_TEST(test_SplitYearDays2, 24);
+  RUN_TEST(test_RataDie1, 25);
+  RUN_TEST(test_LeapYears1, 26);
+  RUN_TEST(test_LeapYears2, 27);
+  RUN_TEST(test_RoundTripDate, 28);
+  RUN_TEST(test_RoundTripYearStart, 29);
+  RUN_TEST(test_RoundTripMonthStart, 30);
+  RUN_TEST(test_RoundTripWeekStart, 31);
+  RUN_TEST(test_RoundTripDayStart, 32);
+  RUN_TEST(test_IsoCalYearsToWeeks, 33);
+  RUN_TEST(test_IsoCalWeeksToYearStart, 34);
+  RUN_TEST(test_IsoCalWeeksToYearEnd, 35);
+  RUN_TEST(test_DaySecToDate, 36);
 
   return (UnityEnd());
 }
index 014151e98dd559703af875ad29f0972efebb6f1b..57b955c2a046b3f00eca2e4d64dce369b31f2a86 100644 (file)
@@ -53,12 +53,12 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("decodenetnum.c");
-  RUN_TEST(test_IPv4AddressOnly, 7);
-  RUN_TEST(test_IPv4AddressWithPort, 8);
-  RUN_TEST(test_IPv6AddressOnly, 10);
-  RUN_TEST(test_IPv6AddressWithPort, 11);
-  RUN_TEST(test_IllegalAddress, 13);
-  RUN_TEST(test_IllegalCharInPort, 14);
+  RUN_TEST(test_IPv4AddressOnly, 8);
+  RUN_TEST(test_IPv4AddressWithPort, 9);
+  RUN_TEST(test_IPv6AddressOnly, 11);
+  RUN_TEST(test_IPv6AddressWithPort, 12);
+  RUN_TEST(test_IllegalAddress, 14);
+  RUN_TEST(test_IllegalCharInPort, 15);
 
   return (UnityEnd());
 }
index 1f2e717c620ac040703f4934e11f673540edcccd..690895fddf40ee2bd9f49e5005b5a1b0e3271f9d 100644 (file)
@@ -49,8 +49,8 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("humandate.c");
-  RUN_TEST(test_RegularTime, 8);
-  RUN_TEST(test_CurrentTime, 9);
+  RUN_TEST(test_RegularTime, 9);
+  RUN_TEST(test_CurrentTime, 10);
 
   return (UnityEnd());
 }
index bae0f85b1709d6b5e16b6c3ec807a423151f0131..fbdeb7a1d549ab5854a247fa4027a916ed2337e4 100644 (file)
@@ -58,17 +58,17 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("lfptostr.c");
-  RUN_TEST(test_PositiveInteger, 23);
-  RUN_TEST(test_NegativeInteger, 24);
-  RUN_TEST(test_PositiveIntegerWithFraction, 25);
-  RUN_TEST(test_NegativeIntegerWithFraction, 26);
-  RUN_TEST(test_RoundingDownToInteger, 27);
-  RUN_TEST(test_RoundingMiddleToInteger, 28);
-  RUN_TEST(test_RoundingUpToInteger, 29);
-  RUN_TEST(test_SingleDecimal, 30);
-  RUN_TEST(test_MillisecondsRoundingUp, 31);
-  RUN_TEST(test_MillisecondsRoundingDown, 32);
-  RUN_TEST(test_UnsignedInteger, 33);
+  RUN_TEST(test_PositiveInteger, 24);
+  RUN_TEST(test_NegativeInteger, 25);
+  RUN_TEST(test_PositiveIntegerWithFraction, 26);
+  RUN_TEST(test_NegativeIntegerWithFraction, 27);
+  RUN_TEST(test_RoundingDownToInteger, 28);
+  RUN_TEST(test_RoundingMiddleToInteger, 29);
+  RUN_TEST(test_RoundingUpToInteger, 30);
+  RUN_TEST(test_SingleDecimal, 31);
+  RUN_TEST(test_MillisecondsRoundingUp, 32);
+  RUN_TEST(test_MillisecondsRoundingDown, 33);
+  RUN_TEST(test_UnsignedInteger, 34);
 
   return (UnityEnd());
 }
index 20e2d9516e5bea4ee9268eb65f76d451662945b8..0c1558e6d9db39bd8dde7c1883dc820efc0fdf1d 100644 (file)
@@ -48,8 +48,8 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("modetoa.c");
-  RUN_TEST(test_KnownMode, 7);
-  RUN_TEST(test_UnknownMode, 8);
+  RUN_TEST(test_KnownMode, 8);
+  RUN_TEST(test_UnknownMode, 9);
 
   return (UnityEnd());
 }
index 544fbc119174f041f33139e36a8da84c0ac141c6..ff264f833fc8132143762297aa46df2c5bcf8784 100644 (file)
@@ -54,14 +54,14 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("msyslog.c");
-  RUN_TEST(test_msnprintf, 13);
-  RUN_TEST(test_msnprintfLiteralPercentm, 14);
-  RUN_TEST(test_msnprintfBackslashLiteralPercentm, 15);
-  RUN_TEST(test_msnprintfBackslashPercent, 16);
-  RUN_TEST(test_msnprintfHangingPercent, 17);
-  RUN_TEST(test_format_errmsgHangingPercent, 18);
-  RUN_TEST(test_msnprintfNullTarget, 19);
-  RUN_TEST(test_msnprintfTruncate, 20);
+  RUN_TEST(test_msnprintf, 14);
+  RUN_TEST(test_msnprintfLiteralPercentm, 15);
+  RUN_TEST(test_msnprintfBackslashLiteralPercentm, 16);
+  RUN_TEST(test_msnprintfBackslashPercent, 17);
+  RUN_TEST(test_msnprintfHangingPercent, 18);
+  RUN_TEST(test_format_errmsgHangingPercent, 19);
+  RUN_TEST(test_msnprintfNullTarget, 20);
+  RUN_TEST(test_msnprintfTruncate, 21);
 
   return (UnityEnd());
 }
index 7a714f54ef4e14ab6faebe2d09e320775306b8b3..9301b84b3fc0ddde5a142ff9713d1c6dbb2aa197 100644 (file)
@@ -52,10 +52,10 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("netof.c");
-  RUN_TEST(test_ClassBAddress, 11);
-  RUN_TEST(test_ClassCAddress, 12);
-  RUN_TEST(test_ClassAAddress, 13);
-  RUN_TEST(test_IPv6Address, 14);
+  RUN_TEST(test_ClassBAddress, 12);
+  RUN_TEST(test_ClassCAddress, 13);
+  RUN_TEST(test_ClassAAddress, 14);
+  RUN_TEST(test_IPv6Address, 15);
 
   return (UnityEnd());
 }
index 640e61c14abd20a0a93ef100b42ec7f0f3b4c2e2..f3368a7210fa913359ba15c5781851b8dcca38e7 100644 (file)
@@ -49,8 +49,8 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("numtoa.c");
-  RUN_TEST(test_Address, 8);
-  RUN_TEST(test_Netmask, 9);
+  RUN_TEST(test_Address, 9);
+  RUN_TEST(test_Netmask, 10);
 
   return (UnityEnd());
 }
index 5ebe15b8f532324da8becaeb8f3a80c0de381981..49b52640bb5147b52dc99ca2389dd7a6fc7fe152 100644 (file)
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("numtohost.c");
-  RUN_TEST(test_LoopbackNetNonResolve, 8);
+  RUN_TEST(test_LoopbackNetNonResolve, 9);
 
   return (UnityEnd());
 }
index e6c5ff3f61b62196128eb5925e4564b31ae4eaaa..e034cc2af7fd9a20ee2e8de60e8a7543374f40f9 100644 (file)
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("prettydate.c");
-  RUN_TEST(test_ConstantDate, 9);
+  RUN_TEST(test_ConstantDate, 10);
 
   return (UnityEnd());
 }
index 1c128e7823562454d672856f5b3ef9b65f36039a..465690f763051fd4c904b7e5f1d47d26c4389efb 100644 (file)
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("refidsmear.c");
-  RUN_TEST(test_refidsmear, 35);
+  RUN_TEST(test_refidsmear, 36);
 
   return (UnityEnd());
 }
index bb9fb605b630f74ac0cd74801ec03d4fd8b73218..d829580b0ce3845cfbf9794bc3b1cbadd408701c 100644 (file)
@@ -49,8 +49,8 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("refnumtoa.c");
-  RUN_TEST(test_LocalClock, 12);
-  RUN_TEST(test_UnknownId, 13);
+  RUN_TEST(test_LocalClock, 13);
+  RUN_TEST(test_UnknownId, 14);
 
   return (UnityEnd());
 }
index 1ebe43ca7993a1de25b296dcf31ef2307a27de1c..bae4e5f488151d7d4abd773920491427eb5f7b4e 100644 (file)
@@ -54,14 +54,14 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("sfptostr.c");
-  RUN_TEST(test_PositiveInteger, 11);
-  RUN_TEST(test_NegativeInteger, 12);
-  RUN_TEST(test_PositiveIntegerPositiveFraction, 13);
-  RUN_TEST(test_NegativeIntegerNegativeFraction, 14);
-  RUN_TEST(test_PositiveIntegerNegativeFraction, 15);
-  RUN_TEST(test_NegativeIntegerPositiveFraction, 16);
-  RUN_TEST(test_SingleDecimalInteger, 17);
-  RUN_TEST(test_SingleDecimalRounding, 18);
+  RUN_TEST(test_PositiveInteger, 12);
+  RUN_TEST(test_NegativeInteger, 13);
+  RUN_TEST(test_PositiveIntegerPositiveFraction, 14);
+  RUN_TEST(test_NegativeIntegerNegativeFraction, 15);
+  RUN_TEST(test_PositiveIntegerNegativeFraction, 16);
+  RUN_TEST(test_NegativeIntegerPositiveFraction, 17);
+  RUN_TEST(test_SingleDecimalInteger, 18);
+  RUN_TEST(test_SingleDecimalRounding, 19);
 
   return (UnityEnd());
 }
index a5066e3f78417ec0249106f103e08b694136f67f..df6ec9c06bfa04ce460377e84a912b61de48d295 100644 (file)
@@ -54,12 +54,12 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("socktoa.c");
-  RUN_TEST(test_IPv4AddressWithPort, 10);
-  RUN_TEST(test_IPv6AddressWithPort, 12);
-  RUN_TEST(test_IgnoreIPv6Fields, 13);
-  RUN_TEST(test_ScopedIPv6AddressWithPort, 15);
-  RUN_TEST(test_HashEqual, 16);
-  RUN_TEST(test_HashNotEqual, 17);
+  RUN_TEST(test_IPv4AddressWithPort, 11);
+  RUN_TEST(test_IPv6AddressWithPort, 13);
+  RUN_TEST(test_IgnoreIPv6Fields, 14);
+  RUN_TEST(test_ScopedIPv6AddressWithPort, 16);
+  RUN_TEST(test_HashEqual, 17);
+  RUN_TEST(test_HashNotEqual, 18);
 
   return (UnityEnd());
 }
index 9cfe0bc9f57fd02c296684d3ee3b08442a21664c..f0f93861ec9b43d86169f5b5257c954056aae7a7 100644 (file)
@@ -52,10 +52,10 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("statestr.c");
-  RUN_TEST(test_PeerRestart, 9);
-  RUN_TEST(test_SysUnspecified, 10);
-  RUN_TEST(test_ClockCodeExists, 11);
-  RUN_TEST(test_ClockCodeUnknown, 12);
+  RUN_TEST(test_PeerRestart, 10);
+  RUN_TEST(test_SysUnspecified, 11);
+  RUN_TEST(test_ClockCodeExists, 12);
+  RUN_TEST(test_ClockCodeUnknown, 13);
 
   return (UnityEnd());
 }
index 74723192c9fe0412cef00108223180bc28b7b0a2..404f57f115a66c088305f1fec26532834c532c6a 100644 (file)
@@ -55,13 +55,13 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("strtolfp.c");
-  RUN_TEST(test_PositiveInteger, 11);
-  RUN_TEST(test_NegativeInteger, 12);
-  RUN_TEST(test_PositiveFraction, 13);
-  RUN_TEST(test_NegativeFraction, 14);
-  RUN_TEST(test_PositiveMsFraction, 15);
-  RUN_TEST(test_NegativeMsFraction, 16);
-  RUN_TEST(test_InvalidChars, 17);
+  RUN_TEST(test_PositiveInteger, 12);
+  RUN_TEST(test_NegativeInteger, 13);
+  RUN_TEST(test_PositiveFraction, 14);
+  RUN_TEST(test_NegativeFraction, 15);
+  RUN_TEST(test_PositiveMsFraction, 16);
+  RUN_TEST(test_NegativeMsFraction, 17);
+  RUN_TEST(test_InvalidChars, 18);
 
   return (UnityEnd());
 }
index 6c26521f02726b066f23938a36b36c8de73dcce8..badc84a9bce234ff26448b451e040efb91af7aa5 100644 (file)
@@ -78,34 +78,34 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("timespecops.c");
-  RUN_TEST(test_Helpers1, 36);
-  RUN_TEST(test_Normalise, 37);
-  RUN_TEST(test_SignNoFrac, 38);
-  RUN_TEST(test_SignWithFrac, 39);
-  RUN_TEST(test_CmpFracEQ, 40);
-  RUN_TEST(test_CmpFracGT, 41);
-  RUN_TEST(test_CmpFracLT, 42);
-  RUN_TEST(test_AddFullNorm, 43);
-  RUN_TEST(test_AddFullOflow1, 44);
-  RUN_TEST(test_AddNsecNorm, 45);
-  RUN_TEST(test_AddNsecOflow1, 46);
-  RUN_TEST(test_SubFullNorm, 47);
-  RUN_TEST(test_SubFullOflow, 48);
-  RUN_TEST(test_SubNsecNorm, 49);
-  RUN_TEST(test_SubNsecOflow, 50);
-  RUN_TEST(test_Neg, 51);
-  RUN_TEST(test_AbsNoFrac, 52);
-  RUN_TEST(test_AbsWithFrac, 53);
-  RUN_TEST(test_Helpers2, 54);
-  RUN_TEST(test_ToLFPbittest, 55);
-  RUN_TEST(test_ToLFPrelPos, 56);
-  RUN_TEST(test_ToLFPrelNeg, 57);
-  RUN_TEST(test_ToLFPabs, 58);
-  RUN_TEST(test_FromLFPbittest, 59);
-  RUN_TEST(test_FromLFPrelPos, 60);
-  RUN_TEST(test_FromLFPrelNeg, 61);
-  RUN_TEST(test_LFProundtrip, 62);
-  RUN_TEST(test_ToString, 63);
+  RUN_TEST(test_Helpers1, 37);
+  RUN_TEST(test_Normalise, 38);
+  RUN_TEST(test_SignNoFrac, 39);
+  RUN_TEST(test_SignWithFrac, 40);
+  RUN_TEST(test_CmpFracEQ, 41);
+  RUN_TEST(test_CmpFracGT, 42);
+  RUN_TEST(test_CmpFracLT, 43);
+  RUN_TEST(test_AddFullNorm, 44);
+  RUN_TEST(test_AddFullOflow1, 45);
+  RUN_TEST(test_AddNsecNorm, 46);
+  RUN_TEST(test_AddNsecOflow1, 47);
+  RUN_TEST(test_SubFullNorm, 48);
+  RUN_TEST(test_SubFullOflow, 49);
+  RUN_TEST(test_SubNsecNorm, 50);
+  RUN_TEST(test_SubNsecOflow, 51);
+  RUN_TEST(test_Neg, 52);
+  RUN_TEST(test_AbsNoFrac, 53);
+  RUN_TEST(test_AbsWithFrac, 54);
+  RUN_TEST(test_Helpers2, 55);
+  RUN_TEST(test_ToLFPbittest, 56);
+  RUN_TEST(test_ToLFPrelPos, 57);
+  RUN_TEST(test_ToLFPrelNeg, 58);
+  RUN_TEST(test_ToLFPabs, 59);
+  RUN_TEST(test_FromLFPbittest, 60);
+  RUN_TEST(test_FromLFPrelPos, 61);
+  RUN_TEST(test_FromLFPrelNeg, 62);
+  RUN_TEST(test_LFProundtrip, 63);
+  RUN_TEST(test_ToString, 64);
 
   return (UnityEnd());
 }
index 4a9351c70ab1c60a1860267845f1d1bc93fcce00..df39ab9c389a490c364ad7fbcee21e08c5690fbd 100644 (file)
@@ -77,34 +77,34 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("timevalops.c");
-  RUN_TEST(test_Helpers1, 38);
-  RUN_TEST(test_Normalise, 39);
-  RUN_TEST(test_SignNoFrac, 40);
-  RUN_TEST(test_SignWithFrac, 41);
-  RUN_TEST(test_CmpFracEQ, 42);
-  RUN_TEST(test_CmpFracGT, 43);
-  RUN_TEST(test_CmpFracLT, 44);
-  RUN_TEST(test_AddFullNorm, 45);
-  RUN_TEST(test_AddFullOflow1, 46);
-  RUN_TEST(test_AddUsecNorm, 47);
-  RUN_TEST(test_AddUsecOflow1, 48);
-  RUN_TEST(test_SubFullNorm, 49);
-  RUN_TEST(test_SubFullOflow, 50);
-  RUN_TEST(test_SubUsecNorm, 51);
-  RUN_TEST(test_SubUsecOflow, 52);
-  RUN_TEST(test_Neg, 53);
-  RUN_TEST(test_AbsNoFrac, 54);
-  RUN_TEST(test_AbsWithFrac, 55);
-  RUN_TEST(test_Helpers2, 56);
-  RUN_TEST(test_ToLFPbittest, 57);
-  RUN_TEST(test_ToLFPrelPos, 58);
-  RUN_TEST(test_ToLFPrelNeg, 59);
-  RUN_TEST(test_ToLFPabs, 60);
-  RUN_TEST(test_FromLFPbittest, 61);
-  RUN_TEST(test_FromLFPrelPos, 62);
-  RUN_TEST(test_FromLFPrelNeg, 63);
-  RUN_TEST(test_LFProundtrip, 64);
-  RUN_TEST(test_ToString, 65);
+  RUN_TEST(test_Helpers1, 39);
+  RUN_TEST(test_Normalise, 40);
+  RUN_TEST(test_SignNoFrac, 41);
+  RUN_TEST(test_SignWithFrac, 42);
+  RUN_TEST(test_CmpFracEQ, 43);
+  RUN_TEST(test_CmpFracGT, 44);
+  RUN_TEST(test_CmpFracLT, 45);
+  RUN_TEST(test_AddFullNorm, 46);
+  RUN_TEST(test_AddFullOflow1, 47);
+  RUN_TEST(test_AddUsecNorm, 48);
+  RUN_TEST(test_AddUsecOflow1, 49);
+  RUN_TEST(test_SubFullNorm, 50);
+  RUN_TEST(test_SubFullOflow, 51);
+  RUN_TEST(test_SubUsecNorm, 52);
+  RUN_TEST(test_SubUsecOflow, 53);
+  RUN_TEST(test_Neg, 54);
+  RUN_TEST(test_AbsNoFrac, 55);
+  RUN_TEST(test_AbsWithFrac, 56);
+  RUN_TEST(test_Helpers2, 57);
+  RUN_TEST(test_ToLFPbittest, 58);
+  RUN_TEST(test_ToLFPrelPos, 59);
+  RUN_TEST(test_ToLFPrelNeg, 60);
+  RUN_TEST(test_ToLFPabs, 61);
+  RUN_TEST(test_FromLFPbittest, 62);
+  RUN_TEST(test_FromLFPrelPos, 63);
+  RUN_TEST(test_FromLFPrelNeg, 64);
+  RUN_TEST(test_LFProundtrip, 65);
+  RUN_TEST(test_ToString, 66);
 
   return (UnityEnd());
 }
index 6ec50f660aa48e413e8c6857058240fc5ec1e258..5667b7062f67061ed9be0067cd33d92bb14f3864 100644 (file)
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("uglydate.c");
-  RUN_TEST(test_ConstantDateTime, 8);
+  RUN_TEST(test_ConstantDateTime, 9);
 
   return (UnityEnd());
 }
index b115ae168ba32a9f92c7b626bc6f5c17297ec9c1..290041b5b9414c5b8224f911797a4131969c624f 100644 (file)
@@ -8,6 +8,7 @@
  
 #define SFP_MAX_PRECISION 6
 
+void setUp(void);
 void test_PositiveInteger(void);
 void test_NegativeInteger(void);
 void test_PositiveIntegerPositiveFraction(void);
@@ -18,6 +19,15 @@ void test_SingleDecimalInteger(void);
 void test_SingleDecimalRounding(void);
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void test_PositiveInteger(void)
 {
        s_fp test = 300 << 16; // exact 300.000000
index dc77ecfb4bf6cf89527cc8de54f48b4fc8703a98..84231060f74395175b358984cfc3847568bb00d2 100644 (file)
@@ -7,6 +7,7 @@
 #include "sockaddrtest.h"
 
 
+void setUp(void);
 void test_IPv4AddressWithPort(void);
 //#ifdef ISC_PLATFORM_HAVEIPV6
 void test_IPv6AddressWithPort(void);
@@ -16,6 +17,16 @@ void test_ScopedIPv6AddressWithPort(void);
 void test_HashEqual(void);
 void test_HashNotEqual(void);
 
+
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void 
 test_IPv4AddressWithPort(void) {
        sockaddr_u input = CreateSockaddr4("192.0.2.10", 123);
index 810ee6b6ea054fdcf082a2deca41d18d19ca989d..e7a1bd7cf034c21503174b4b74b61137bf925ccf 100644 (file)
@@ -6,11 +6,22 @@
 
 #include "unity.h"
 
+void setUp(void);
 void test_PeerRestart(void);
 void test_SysUnspecified(void);
 void test_ClockCodeExists(void);
 void test_ClockCodeUnknown(void);
 
+
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 // eventstr()
 void
 test_PeerRestart(void) {
index f40ab508a4afd2c5095f7790a8e05eeea630ceda..6855d9ba3a8accf21eba4807289e140a43efd8db 100644 (file)
@@ -8,6 +8,7 @@
 
 /* This file tests both atolfp and mstolfp */
 
+void setUp(void);
 void test_PositiveInteger(void);
 void test_NegativeInteger(void);
 void test_PositiveFraction(void);
@@ -17,6 +18,15 @@ void test_NegativeMsFraction(void);
 void test_InvalidChars(void);
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void test_PositiveInteger(void) {
        const char *str = "500";
        const char *str_ms = "500000";
index 676a358572455672fa0e18ff91ee9a3e113f3254..68a472ab5f355a104c3e69d9850c4a7e990c435a 100644 (file)
@@ -33,6 +33,7 @@ struct lfpfracdata {
 };
 
 
+void setUp(void);
 void test_Helpers1(void);
 void test_Normalise(void);
 void test_SignNoFrac(void);
@@ -76,6 +77,15 @@ bool         AssertTimespecClose(const struct timespec m,
 //***************************MY CUSTOM FUNCTIONS***************************
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 const bool
 timespec_isValid(struct timespec V)
 {
index 32fe4fb01934783aa512e80959b9089a8a1370a8..99a48eb9a75b8821d715b86b698dae3ca8b3da32 100644 (file)
@@ -35,6 +35,7 @@ l_fp l_fp_init(int32 i, u_int32 f);
 bool AssertTimevalClose(const struct timeval m, const struct timeval n, const struct timeval limit);
 bool AssertFpClose(const l_fp m, const l_fp n, const l_fp limit);
 
+void setUp(void);
 void test_Helpers1(void);
 void test_Normalise(void);
 void test_SignNoFrac(void);
@@ -68,6 +69,15 @@ void test_ToString(void);
 //**********************************MY CUSTOM FUNCTIONS***********************
 
 
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 struct timeval
 timeval_init(time_t hi, long lo)
 {
index a044314cb4db0bff28ed13a27fa4854329e137db..3a5aa8adb7c0539730c3730eac8241b4b95c2efb 100644 (file)
@@ -5,14 +5,26 @@
 
 #include "unity.h"
 
+void setUp(void);
 void test_ConstantDateTime(void);
 
+
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
 void
-test_ConstantDateTime(void) {
+test_ConstantDateTime(void)
+{
        const u_int32 HALF = 2147483648UL;
 
        l_fp e_time = {{3485080800UL}, HALF}; /* 2010-06-09 14:00:00.5 */
 
        TEST_ASSERT_EQUAL_STRING("3485080800.500000 10:159:14:00:00.500",
                                 uglydate(&e_time));
+       return;
 }
index be0a768fec819eb3feab024451c8200fd4a95edd..e65cd01097ad32903efaef0c91617b432a43c66e 100644 (file)
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
 {
   progname = argv[0];
   UnityBegin("uglydate.c");
-  RUN_TEST(test_ConstantDateTime, 8);
+  RUN_TEST(test_ConstantDateTime, 9);
 
   return (UnityEnd());
 }
index 98fa51f2d79485661848f895880b6301c6cb4faf..6954d9e5d6db5fe7ac939d56c9ecb917263055a9 100644 (file)
@@ -131,6 +131,8 @@ main()
        l_fp l;
        int rc;
 
+       init_lib();
+
        rtol(0xfe800000);
        rtol(0xfe800001);
        rtol(0xfe8ffffe);
index 394d59436e4f446c36ac4849f65843dd6a51864d..77f36c558621ad07a5f776816df079570d41154d 100644 (file)
@@ -5,8 +5,19 @@
 //#include "ntp_stdlib.h"
 //#include "libntptest.h"
 
+void setUp(void);
 void test_ConstantDateTime(void);
 
+
+void
+setUp(void)
+{
+       init_lib();
+
+       return;
+}
+
+
 void
 test_ConstantDateTime(void)
 {