fix formatting, cleanup. Tomasz Flendrich
* tests/libntp/lfptostr.c remove unnecessary include, add consts, fix formatting.
Tomasz Flendrich
+* tests/libntp/statestr.c remove empty functions, remove unnecessary include,
+ fix formatting. Tomasz Flendrich
* tests/libntp/modetoa.c fixed formatting. Tomasz Flendrich
* tests/libntp/msyslog.c fixed formatting. Tomasz Flendrich
* tests/libntp/numtoa.c deleted unnecessary empty functions, fixed formatting.
Tomasz Flendrich
* tests/libntp/numtohost.c added const, fixed formatting. Tomasz Flendrich
* tests/libntp/refnumtoa.c fixed formatting. Tomasz Flendrich
+* tests/libntp/ssl_init.c fixed formatting. Tomasz Flendrich
+* tests/libntp/tvtots.c fixed a bug, fixed formatting. Tomasz Flendrich
+* tests/libntp/uglydate.c removed an unnecessary include. Tomasz Flendrich
+* tests/libntp/vi64ops.c removed an unnecessary comment, fixed formatting.
+* tests/libntp/ymd3yd.c removed an empty function and an unnecessary include,
+fixed formatting. Tomasz Flendrich
* sntp/unity/Makefile.am added a missing header. Tomasz Flendrich
* sntp/unity/unity_config.h: Distribute it. Harlan Stenn.
* sntp/libevent/evconfig-private.h: remove generated filefrom SCM. H.Stenn.
progname = argv[0];
Unity.TestFile = "ssl_init.c";
UnityBegin("ssl_init.c");
- RUN_TEST(test_MD5KeyTypeWithoutDigestLength, 19);
- RUN_TEST(test_MD5KeyTypeWithDigestLength, 23);
- RUN_TEST(test_SHA1KeyTypeWithDigestLength, 32);
- RUN_TEST(test_MD5KeyName, 47);
- RUN_TEST(test_SHA1KeyName, 51);
+ RUN_TEST(test_MD5KeyTypeWithoutDigestLength, 20);
+ RUN_TEST(test_MD5KeyTypeWithDigestLength, 25);
+ RUN_TEST(test_SHA1KeyTypeWithDigestLength, 35);
+ RUN_TEST(test_MD5KeyName, 51);
+ RUN_TEST(test_SHA1KeyName, 57);
return (UnityEnd());
}
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
+void resetTest(void);
extern void test_PeerRestart(void);
extern void test_SysUnspecified(void);
extern void test_ClockCodeExists(void);
progname = argv[0];
Unity.TestFile = "statestr.c";
UnityBegin("statestr.c");
- RUN_TEST(test_PeerRestart, 20);
- RUN_TEST(test_SysUnspecified, 24);
- RUN_TEST(test_ClockCodeExists, 29);
- RUN_TEST(test_ClockCodeUnknown, 33);
+ RUN_TEST(test_PeerRestart, 12);
+ RUN_TEST(test_SysUnspecified, 18);
+ RUN_TEST(test_ClockCodeExists, 25);
+ RUN_TEST(test_ClockCodeUnknown, 31);
return (UnityEnd());
}
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
+void resetTest(void);
extern void test_Seconds(void);
extern void test_MicrosecondsRounded(void);
extern void test_MicrosecondsExact(void);
progname = argv[0];
Unity.TestFile = "tvtots.c";
UnityBegin("tvtots.c");
- RUN_TEST(test_Seconds, 10);
- RUN_TEST(test_MicrosecondsRounded, 21);
- RUN_TEST(test_MicrosecondsExact, 36);
+ RUN_TEST(test_Seconds, 12);
+ RUN_TEST(test_MicrosecondsRounded, 25);
+ RUN_TEST(test_MicrosecondsExact, 43);
return (UnityEnd());
}
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
+void resetTest(void);
extern void test_ConstantDateTime(void);
progname = argv[0];
Unity.TestFile = "uglydate.c";
UnityBegin("uglydate.c");
- RUN_TEST(test_ConstantDateTime, 11);
+ RUN_TEST(test_ConstantDateTime, 10);
return (UnityEnd());
}
progname = argv[0];
Unity.TestFile = "vi64ops.c";
UnityBegin("vi64ops.c");
- RUN_TEST(test_ParseVUI64_pos, 32);
- RUN_TEST(test_ParseVUI64_neg, 46);
- RUN_TEST(test_ParseVUI64_case, 59);
+ RUN_TEST(test_ParseVUI64_pos, 33);
+ RUN_TEST(test_ParseVUI64_neg, 49);
+ RUN_TEST(test_ParseVUI64_case, 63);
return (UnityEnd());
}
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
+void resetTest(void);
extern void test_NonLeapYearFebruary(void);
extern void test_NonLeapYearJune(void);
extern void test_LeapYearFebruary(void);
progname = argv[0];
Unity.TestFile = "ymd2yd.c";
UnityBegin("ymd2yd.c");
- RUN_TEST(test_NonLeapYearFebruary, 17);
- RUN_TEST(test_NonLeapYearJune, 21);
- RUN_TEST(test_LeapYearFebruary, 26);
- RUN_TEST(test_LeapYearDecember, 30);
+ RUN_TEST(test_NonLeapYearFebruary, 9);
+ RUN_TEST(test_NonLeapYearJune, 15);
+ RUN_TEST(test_LeapYearFebruary, 22);
+ RUN_TEST(test_LeapYearDecember, 28);
return (UnityEnd());
}
// keytype_from_text()
-void test_MD5KeyTypeWithoutDigestLength(void) {
+void
+test_MD5KeyTypeWithoutDigestLength(void) {
TEST_ASSERT_EQUAL(KEY_TYPE_MD5, keytype_from_text("MD5", NULL));
}
-void test_MD5KeyTypeWithDigestLength(void) {
+void
+test_MD5KeyTypeWithDigestLength(void) {
size_t digestLength;
size_t expected = TEST_MD5_DIGEST_LENGTH;
}
-void test_SHA1KeyTypeWithDigestLength(void) {
+void
+test_SHA1KeyTypeWithDigestLength(void) {
#ifdef OPENSSL
size_t digestLength;
size_t expected = TEST_SHA1_DIGEST_LENGTH;
// keytype_name()
-void test_MD5KeyName(void) {
+void
+test_MD5KeyName(void) {
TEST_ASSERT_EQUAL_STRING("MD5", keytype_name(KEY_TYPE_MD5));
}
-void test_SHA1KeyName(void) {
+
+void
+test_SHA1KeyName(void) {
#ifdef OPENSSL
TEST_ASSERT_EQUAL_STRING("SHA", keytype_name(NID_sha));
#else
TEST_IGNORE_MESSAGE("Skipping because OPENSSL isn't defined");
#endif /* OPENSSL */
}
-
#include "config.h"
#include "ntp_stdlib.h"
-#include "ntp_calendar.h"
-#include "ntp.h" // Needed for MAX_MAC_LEN used in ntp_control.h
+#include "ntp.h" // needed for MAX_MAC_LEN used in ntp_control.h
#include "ntp_control.h"
#include "unity.h"
-void setUp(void)
-{
-}
-
-void tearDown(void)
-{
-}
-
// eventstr()
-void test_PeerRestart(void) {
+void
+test_PeerRestart(void) {
TEST_ASSERT_EQUAL_STRING("restart", eventstr(PEVNT_RESTART));
}
-void test_SysUnspecified(void) {
+
+void
+test_SysUnspecified(void) {
TEST_ASSERT_EQUAL_STRING("unspecified", eventstr(EVNT_UNSPEC));
}
+
// ceventstr()
-void test_ClockCodeExists(void) {
+void
+test_ClockCodeExists(void) {
TEST_ASSERT_EQUAL_STRING("clk_unspec", ceventstr(CTL_CLK_OKAY));
}
-void test_ClockCodeUnknown(void) {
+
+void
+test_ClockCodeUnknown(void) {
TEST_ASSERT_EQUAL_STRING("clk_-1", ceventstr(-1));
}
-
#include "timevalops.h"
#include "unity.h"
-#include <math.h>// Required on Solaris for ldexp.
+#include <math.h> // Required on Solaris for ldexp.
-void test_Seconds(void)
+
+void
+test_Seconds(void)
{
struct timeval input = {500, 0}; // 500.0 s
l_fp expected = {500, 0};
TEST_ASSERT_TRUE(IsEqual(expected, actual));
}
-void test_MicrosecondsRounded(void)
+
+void
+test_MicrosecondsRounded(void)
{
/* 0.0005 can not be represented exact in a l_fp structure.
* It would equal to 2147483,648. This means that
l_fp actual;
TVTOTS(&input, &actual);
+
TEST_ASSERT_TRUE(IsEqual(expected, actual));
}
-void test_MicrosecondsExact(void)
+
+void
+test_MicrosecondsExact(void)
{
// 0.5 can be represented exact in both l_fp and timeval.
const struct timeval input = {10, 500000}; // 0.5 exact
M_LFPTOD(0, actual.l_uf, actualDouble);
// The error should be less than 0.5 us
- TEST_ASSERT_DOUBLE_WITHIN(0000005, expectedDouble, actualDouble);
+ TEST_ASSERT_DOUBLE_WITHIN(0.0000005, expectedDouble, actualDouble);
}
#include "config.h"
#include "ntp_stdlib.h"
-#include "ntp_calendar.h"
#include "ntp_fp.h"
#include "unity.h"
#include "config.h"
#include "ntp_stdlib.h"
+#include "vint64ops.h"
#include "unity.h"
-#include "vint64ops.h"
-//technically bool
-int IsEqual(const vint64 expected, const vint64 actual) {
+// technically bool
+int
+IsEqual(const vint64 expected, const vint64 actual) {
if (0 == memcmp(&expected, &actual, sizeof(vint64))) {
- printf( "%x.", expected.D_s.hi); //<< std::hex << expected.D_s.hi << '.'
- printf("%x",expected.D_s.lo);
+ printf( "%x.", expected.D_s.hi);
+ printf("%x", expected.D_s.lo);
printf(" but was ");
- printf("%x.",actual.D_s.hi);
- printf("%x\n",actual.D_s.lo);
+ printf("%x.", actual.D_s.hi);
+ printf("%x\n", actual.D_s.lo);
return TRUE;
} else {
-
printf("expected: ");
printf( "%d.", expected.D_s.hi);
- printf("%d",expected.D_s.lo);
+ printf("%d", expected.D_s.lo);
printf(" but was ");
- printf("%d",actual.D_s.lo);
- printf("%d",actual.D_s.lo);
+ printf("%d", actual.D_s.lo);
+ printf("%d", actual.D_s.lo);
return FALSE;
}
}
// ----------------------------------------------------------------------
// test number parser
-void test_ParseVUI64_pos(void) {
+void
+test_ParseVUI64_pos(void) {
vint64 act, exp;
const char *sp;
char *ep;
TEST_ASSERT_EQUAL(*ep, 'x');
}
-void test_ParseVUI64_neg(void) {
+
+void
+test_ParseVUI64_neg(void) {
vint64 act, exp;
const char *sp;
char *ep;
TEST_ASSERT_EQUAL(*ep, 'x');
}
-void test_ParseVUI64_case(void) {
+void
+test_ParseVUI64_case(void) {
vint64 act, exp;
const char *sp;
char *ep;
TEST_ASSERT_TRUE(IsEqual(exp, act));
TEST_ASSERT_EQUAL(*ep, '\0');
}
-
#include "config.h"
#include "ntp_stdlib.h"
-#include "ntp_calendar.h"
#include "unity.h"
-void setUp(void)
-{
-}
-void tearDown(void)
-{
+void
+test_NonLeapYearFebruary(void) {
+ TEST_ASSERT_EQUAL(31 + 20, ymd2yd(2010, 2, 20)); //2010-02-20
}
-void test_NonLeapYearFebruary (void) {
- TEST_ASSERT_EQUAL(31+20, ymd2yd(2010,2,20)); //2010-02-20
-}
-
-void test_NonLeapYearJune (void) {
+void
+test_NonLeapYearJune(void) {
int expected = 31+28+31+30+31+18; // 18 June non-leap year
- TEST_ASSERT_EQUAL(expected, ymd2yd(2011,6,18));
+ TEST_ASSERT_EQUAL(expected, ymd2yd(2011, 6, 18));
}
-void test_LeapYearFebruary (void) {
- TEST_ASSERT_EQUAL(31+20, ymd2yd(2012,2,20)); //2012-02-20 (leap year)
+
+void
+test_LeapYearFebruary(void) {
+ TEST_ASSERT_EQUAL(31 + 20, ymd2yd(2012, 2, 20)); //2012-02-20 (leap year)
}
-void test_LeapYearDecember (void) {
+
+void
+test_LeapYearDecember(void) {
// 2012-12-31
int expected = 31+29+31+30+31+30+31+31+30+31+30+31;
- TEST_ASSERT_EQUAL(expected, ymd2yd(2012,12,31));
+ TEST_ASSERT_EQUAL(expected, ymd2yd(2012, 12, 31));
}
-