test-decodenetnum \
test-hextoint \
test-hextolfp \
+ test-humandate \
test-lfpfunc \
test-modetoa \
test-netof \
g_decodenetnum.cpp \
g_hextoint.cpp \
g_hextolfp.cpp \
- humandate.cpp \
+ g_humandate.cpp \
g_lfpfunc.cpp \
lfptostr.cpp \
g_modetoa.cpp \
$(srcdir)/run-decodenetnum.c \
$(srcdir)/run-hextoint.c \
$(srcdir)/run-hextolfp.c \
+ $(srcdir)/run-humandate.c \
$(srcdir)/run-lfpfunc.c \
$(srcdir)/run-modetoa.c \
$(srcdir)/run-netof.c \
$(top_builddir)/sntp/unity/libunity.a \
$(NULL)
+test_humandate_CFLAGS = \
+ -I$(top_srcdir)/sntp/unity \
+ $(NULL)
+
+test_humandate_LDADD = \
+ $(LDADD) \
+ $(top_builddir)/sntp/unity/libunity.a \
+ $(NULL)
+
test_modetoa_SOURCES = \
modetoa.c \
run-sfptostr.c \
$(NULL)
+test_humandate_SOURCES = \
+ humandate.c \
+ run-humandate.c \
+ $(NULL)
+
$(srcdir)/run-modetoa.c: $(srcdir)/modetoa.c $(std_unity_list)
$(run_unity) modetoa.c run-modetoa.c
$(srcdir)/run-sfptostr.c: $(srcdir)/sfptostr.c $(std_unity_list)
$(run_unity) sfptostr.c run-sfptostr.c
+$(srcdir)/run-humandate.c: $(srcdir)/humandate.c $(std_unity_list)
+ $(run_unity) humandate.c run-humandate.c
+
TESTS =
--- /dev/null
+#include "config.h"
+#include "unity.h"
+#include "ntp_calendar.h"
+#include "ntp_stdlib.h"
+#include <stdio.h>
+
+void test_RegularTime(void)
+{
+ time_t sample = 1276601278;
+ char expected[15];
+
+ struct tm* time;
+ time = localtime(&sample);
+ TEST_ASSERT_TRUE(time != NULL);
+
+ snprintf(expected, 15, "%02d:%02d:%02d", time->tm_hour, time->tm_min, time->tm_sec);
+
+ TEST_ASSERT_EQUAL_STRING(expected, humantime(sample));
+}
+
+void test_CurrentTime(void)
+{
+ time_t sample;
+ char expected[15];
+
+ time(&sample);
+
+ struct tm* time;
+ time = localtime(&sample);
+ TEST_ASSERT_TRUE(time != NULL);
+
+ snprintf(expected, 15, "%02d:%02d:%02d", time->tm_hour, time->tm_min, time->tm_sec);
+
+ TEST_ASSERT_EQUAL_STRING(expected, humantime(sample));
+}
--- /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_RegularTime(void);
+extern void test_CurrentTime(void);
+
+
+//=======Test Reset Option=====
+void resetTest()
+{
+ tearDown();
+ setUp();
+}
+
+char *progname;
+
+
+//=======MAIN=====
+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);
+
+ 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_PositiveInteger(void);
+extern void test_NegativeInteger(void);
+extern void test_PositiveIntegerPositiveFraction(void);
+extern void test_NegativeIntegerNegativeFraction(void);
+extern void test_PositiveIntegerNegativeFraction(void);
+extern void test_NegativeIntegerPositiveFraction(void);
+extern void test_SingleDecimalInteger(void);
+extern void test_SingleDecimalRounding(void);
+
+
+//=======Test Reset Option=====
+void resetTest()
+{
+ tearDown();
+ setUp();
+}
+
+char *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+ progname = argv[0];
+ Unity.TestFile = "sfptostr.c";
+ UnityBegin("sfptostr.c");
+ RUN_TEST(test_PositiveInteger, 11);
+ RUN_TEST(test_NegativeInteger, 19);
+ RUN_TEST(test_PositiveIntegerPositiveFraction, 27);
+ RUN_TEST(test_NegativeIntegerNegativeFraction, 35);
+ RUN_TEST(test_PositiveIntegerNegativeFraction, 43);
+ RUN_TEST(test_NegativeIntegerPositiveFraction, 51);
+ RUN_TEST(test_SingleDecimalInteger, 59);
+ RUN_TEST(test_SingleDecimalRounding, 67);
+
+ return (UnityEnd());
+}