--- /dev/null
+//#include "config.h"
+//#include "libntptest.h"
+#include "unity.h"
+//#include "ntp_stdlib.h"
+
+
+
+void test_KnownMode(void) {
+ const int MODE = 3; // Should be "client"
+ TEST_ASSERT_EQUAL_STRING("client", modetoa(MODE));
+
+// EXPECT_STREQ("client", modetoa(MODE));
+}
+
+void test_UnknownMode(void) {
+ const int MODE = 100;
+
+ TEST_ASSERT_EQUAL_STRING("mode#1001", modetoa(MODE));
+// EXPECT_STREQ("mode#100", modetoa(MODE));
+}
--- /dev/null
+#include "test-libntp.h"
+#include <stdio.h> /* HMS: for the printf's below */
+
+void
+setUp(void)
+{
+ printf("setUp from big test");
+}
+
+void
+tearDown(void)
+{
+}
+
+void
+test_modetoa(void)
+{
+printf("modetoa:test_KnownMode()\n");
+ test_KnownMode();
+printf("modetoa:test_UnknownMode()\n");
+ test_UnknownMode();
+}
+
+void
+test_uglydate(void)
+{
+printf("uglydate:test_ConstantDateTime()\n");
+ test_ConstantDateTime();
+}
--- /dev/null
+// From modetoa.c:
+extern void test_KnownMode(void);
+extern void test_UnknownMode(void);
+
+// From uglydate.c:
+extern void test_ConstantDateTime(void);
--- /dev/null
+#include "libntptest.h"
+
+/* This file contains various constants that libntp needs to be set
+ * and that is normally defined in ntpd/ntpq/...
+ */
+
+u_long current_time = 4; // needed by authkeys. Used only in to calculate lifetime.
+const char *progname = "libntptest";
+
+time_t nowtime = 0;
+
+time_t timefunc(time_t *ptr)
+{
+ if (ptr)
+ *ptr = nowtime;
+ return nowtime;
+}
+
+void settime(int y, int m, int d, int H, int M, int S)
+{
+
+ time_t days(ntpcal_edate_to_eradays(y-1, m-1, d-1) + 1 - DAY_UNIX_STARTS);
+ time_t secs(ntpcal_etime_to_seconds(H, M, S));
+
+ nowtime = days * SECSPERDAY + secs;
+}
+
--- /dev/null
+//#include "tests_main.h"
+
+#include "ntp_stdlib.h"
+#include "ntp_calendar.h"
+
+ static time_t timefunc(time_t*);
+ static time_t nowtime;
+ static void settime(int y, int m, int d, int H, int M, int S);
+
--- /dev/null
+#include "config.h"
+#include "ntp_fp.h"
+#include "unity.h"
+
+//#include "ntp_stdlib.h"
+//#include "libntptest.h"
+
+void
+test_ConstantDateTime(void) {
+ const u_int32 HALF = 2147483648UL;
+
+ l_fp time = {3485080800UL, HALF}; // 2010-06-09 14:00:00.5
+
+ TEST_ASSERT_EQUAL_STRING("3485080800.500000 10:159:14:00:00.500",
+ uglydate(&time));
+}
--- /dev/null
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_ConstantDateTime(void);
+
+
+//=======Test Reset Option=====
+void resetTest()
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ Unity.TestFile = "uglydate.c";
+ UnityBegin("");
+ RUN_TEST(test_ConstantDateTime, 9);
+
+ return (UnityEnd());
+}
--- /dev/null
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_KnownMode(void);
+extern void test_UnknownMode(void);
+
+
+//=======Test Reset Option=====
+void resetTest()
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ Unity.TestFile = "modetoa.c";
+ UnityBegin("");
+ RUN_TEST(test_KnownMode, 8);
+ RUN_TEST(test_UnknownMode, 15);
+
+ return (UnityEnd());
+}
--- /dev/null
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_main(void );
+extern void test_XPASS(void);
+extern void test_XFAIL(void);
+extern void test_XFAIL_WITH_MESSAGE(void);
+extern void test_main_incorrect(void);
+extern void test_ignored(void);
+
+
+//=======Test Reset Option=====
+void resetTest()
+{
+ tearDown();
+ setUp();
+}
+
+
+//=======MAIN=====
+int main(void)
+{
+ Unity.TestFile = "ut-2803.c";
+ UnityBegin("");
+ RUN_TEST(test_main, 30);
+ RUN_TEST(test_XPASS, 37);
+ RUN_TEST(test_XFAIL, 49);
+ RUN_TEST(test_XFAIL_WITH_MESSAGE, 61);
+ RUN_TEST(test_main_incorrect, 73);
+ RUN_TEST(test_ignored, 77);
+
+ return (UnityEnd());
+}