]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
caljulian.c:
authorDamir Tomic <viperus@ntp.org>
Sun, 14 Jun 2015 08:05:45 +0000 (10:05 +0200)
committerDamir Tomic <viperus@ntp.org>
Sun, 14 Jun 2015 08:05:45 +0000 (10:05 +0200)
  minor cleanup
Makefile.am:
  mereged with Harlan's Makefile.am@1.55 version.

bk: 557d35d9Gf_mptjndBIJmUPtxopmsA

tests/libntp/Makefile.am
tests/libntp/caljulian.c

index 11a824a35d61a690c2f1cacff2f3f6b5543638a3..a05f414d26a6e89c6cc85029f5f77ce1c564f76a 100644 (file)
@@ -5,9 +5,25 @@ CLEANFILES =
 run_unity =    cd $(srcdir) && ruby ../../sntp/unity/auto/generate_test_runner.rb
 
 #removed test-libntp
-check_PROGRAMS = test-modetoa test-uglydate test-ymd2yd test-statestr test-numtoa test-numtohost \
-test-hextoint test-atoint test-atouint test-authkeys test-a_md5encrypt test-lfpfunc test-vi64ops \
-test-refnumtoa test-calyearstart test-clocktime test-caljulian
+check_PROGRAMS =               \
+       test-modetoa            \
+       test-uglydate           \
+       test-ymd2yd             \
+       test-statestr           \
+       test-numtoa             \
+       test-numtohost          \
+       test-hextoint           \
+       test-atoint             \
+       test-atouint            \
+       test-authkeys           \
+       test-a_md5encrypt       \
+       test-lfpfunc            \
+       test-vi64ops            \
+       test-refnumtoa          \
+       test-calyearstart       \
+       test-clocktime          \
+       test-caljulian          \
+       $(NULL)
 
 if GTEST_AVAILABLE
 check_PROGRAMS += tests
@@ -30,8 +46,8 @@ tests_LDADD =                         \
        $(NULL)
 
 unity_tests_LDADD =                            \
-       $(LDADD)                                \
-       $(top_builddir)/sntp/unity/libunity.a   \
+       $(LDADD)                                \
+       $(top_builddir)/sntp/unity/libunity.a   \
        $(NULL)
 
 AM_CFLAGS   = $(CFLAGS_NTP)
@@ -44,7 +60,8 @@ AM_CPPFLAGS += $(CPPFLAGS_NTP)
 
 AM_LDFLAGS = $(LDFLAGS_NTP)
 
-tests_SOURCES = $(top_srcdir)/sntp/tests_main.cpp      \
+tests_SOURCES =                                        \
+               $(top_srcdir)/sntp/tests_main.cpp       \
                libntptest.cpp          \
                g_a_md5encrypt.cpp      \
                g_atoint.cpp            \
@@ -96,16 +113,16 @@ noinst_HEADERS =   \
 #$(srcdir)/run-test-libntp.c: $(srcdir)/test-libntp.c $(std_unity_list)
 #      $(run_unity) test-libntp.c run-test-libntp.c
 
-#test_libntp_CFLAGS =                  \
+#test_libntp_CFLAGS =                  \
 #      -I$(top_srcdir)/sntp/unity      \
 #      $(NULL)
 
-#test_libntp_LDADD =                           \
+#test_libntp_LDADD =                           \
 #      $(LDADD)                                \
 #      $(top_builddir)/sntp/unity/libunity.a   \
 #      $(NULL)
 
-test_modetoa_CFLAGS =                  \
+test_modetoa_CFLAGS =                  \
        -I$(top_srcdir)/sntp/unity      \
        $(NULL)
 
@@ -118,235 +135,246 @@ test_uglydate_CFLAGS =                  \
        -I$(top_srcdir)/sntp/unity      \
        $(NULL)
 
-test_uglydate_LDADD =                          \
+test_uglydate_LDADD =                          \
        $(LDADD)                                \
        $(top_builddir)/sntp/unity/libunity.a   \
        $(NULL)
 
-test_ymd2yd_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_ymd2yd_CFLAGS =                   \
+       -I$(top_srcdir)/sntp/unity      \
        $(NULL)
 
-test_ymd2yd_LDADD =                           \
-       $(LDADD)                                \
-       $(top_builddir)/sntp/unity/libunity.a   \
+test_ymd2yd_LDADD =                            \
+       $(LDADD)                                \
+       $(top_builddir)/sntp/unity/libunity.a   \
        $(NULL)
 
-test_statestr_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_statestr_CFLAGS =                         \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_statestr_LDADD =                           \
-       $(LDADD)                                \
-       $(top_builddir)/sntp/unity/libunity.a   \
+test_statestr_LDADD =                          \
+       $(LDADD)                                \
+       $(top_builddir)/sntp/unity/libunity.a   \
        $(NULL)
 
-test_numtoa_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_numtoa_CFLAGS =                           \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_numtoa_LDADD =                           \
-       $(unity_tests_LDADD)    
+test_numtoa_LDADD =                            \
+       $(unity_tests_LDADD)                    \
+       $(NULL)
 
-test_numtohost_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_numtohost_CFLAGS =                                \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_numtohost_LDADD =                  \
-       $(unity_tests_LDADD)            \
+test_numtohost_LDADD =                         \
+       $(unity_tests_LDADD)                    \
        $(NULL)
 
-test_hextoint_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_hextoint_CFLAGS =                         \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_hextoint_LDADD =                   \
+test_hextoint_LDADD =                          \
        $(unity_tests_LDADD)
        $(NULL)
 
-test_atoint_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_atoint_CFLAGS =                           \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_atoint_LDADD =                   \
+test_atoint_LDADD =                            \
        $(unity_tests_LDADD)
        $(NULL)
 
-test_a_md5encrypt_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_a_md5encrypt_CFLAGS =                     \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_a_md5encrypt_LDADD =                   \
-       $(unity_tests_LDADD)            \
+test_a_md5encrypt_LDADD =                      \
+       $(unity_tests_LDADD)                    \
        $(NULL)
 
-test_atouint_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_atouint_CFLAGS =                          \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_atouint_LDADD =                   \
+test_atouint_LDADD =                           \
        $(unity_tests_LDADD)
        $(NULL)
 
-test_authkeys_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_authkeys_CFLAGS =                         \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_authkeys_LDADD =                           \
+test_authkeys_LDADD =                          \
        $(unity_tests_LDADD)                    \
        $(NULL)
 
-test_lfpfunc_CFLAGS =                          \
-       -I$(top_srcdir)/sntp/unity      \
-       -DUNITY_INCLUDE_DOUBLE          \
+test_lfpfunc_CFLAGS =                          \
+       -I$(top_srcdir)/sntp/unity              \
+       -DUNITY_INCLUDE_DOUBLE                  \
        $(NULL)
 
-test_lfpfunc_LDADD =                   \
-       $(unity_tests_LDADD)            \
+test_lfpfunc_LDADD =                           \
+       $(unity_tests_LDADD)                    \
        $(NULL)
 
-test_vi64ops_CFLAGS =                          \
-       -I$(top_srcdir)/sntp/unity      \
+test_vi64ops_CFLAGS =                          \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_vi64ops_LDADD =                   \
-       $(unity_tests_LDADD)            \
+test_vi64ops_LDADD =                           \
+       $(unity_tests_LDADD)                    \
        $(NULL)
 
-test_refnumtoa_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_refnumtoa_CFLAGS =                                \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_refnumtoa_LDADD =                           \
-       $(LDADD)                                \
-       $(top_builddir)/sntp/unity/libunity.a   \
+test_refnumtoa_LDADD =                         \
+       $(LDADD)                                \
+       $(top_builddir)/sntp/unity/libunity.a   \
        $(NULL)
 
-test_calyearstart_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_calyearstart_CFLAGS =                     \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_calyearstart_LDADD =                           \
-       $(LDADD)                                \
-       $(top_builddir)/sntp/unity/libunity.a   \
+test_calyearstart_LDADD =                      \
+       $(LDADD)                                \
+       $(top_builddir)/sntp/unity/libunity.a   \
        $(NULL)
 
-test_clocktime_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_clocktime_CFLAGS =                                \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_clocktime_LDADD =                           \
-       $(LDADD)                                \
-       $(top_builddir)/sntp/unity/libunity.a   \
+test_clocktime_LDADD =                         \
+       $(LDADD)                                \
+       $(top_builddir)/sntp/unity/libunity.a   \
        $(NULL)
 
-test_caljulian_CFLAGS =                  \
-       -I$(top_srcdir)/sntp/unity      \
+test_caljulian_CFLAGS =                                \
+       -I$(top_srcdir)/sntp/unity              \
        $(NULL)
 
-test_caljulian_LDADD =                           \
-       $(LDADD)                                \
-       $(top_builddir)/sntp/unity/libunity.a   \
+test_caljulian_LDADD =                         \
+       $(LDADD)                                \
+       $(top_builddir)/sntp/unity/libunity.a   \
        $(NULL)
 
-
-#removed one combined test, because unity devs suggested we use one program per test
-#test_libntp_SOURCES =                         \
-#      modetoa.c                       \
-#      uglydate.c                      \
-#      test-libntp.c                   \
-#      test-libntp.h                   \
-#      run-test-libntp.c               \
-#      $(NULL)
-
-test_modetoa_SOURCES =                         \
+test_modetoa_SOURCES =                 \
        modetoa.c                       \
        run-test-modetoa.c              \
        $(NULL)
 
-test_uglydate_SOURCES =                \
+test_uglydate_SOURCES =                        \
        uglydate.c                      \
-       run-test-uglydate.c                     \
+       run-test-uglydate.c             \
        $(NULL)
 
-test_ymd2yd_SOURCES =                  \
-       ymd2yd.c                       \
-       run-test-ymd2yd.c              \
+test_ymd2yd_SOURCES =                  \
+       ymd2yd.c                        \
+       run-test-ymd2yd.c               \
        $(NULL)
 
-test_statestr_SOURCES =                  \
-       statestr.c                       \
-       run-test-statestr.c              \
+test_statestr_SOURCES =                        \
+       statestr.c                      \
+       run-test-statestr.c             \
        $(NULL)
 
-test_numtoa_SOURCES =                  \
-       numtoa.c                       \
-       run-test-numtoa.c              \
+test_numtoa_SOURCES =                  \
+       numtoa.c                        \
+       run-test-numtoa.c               \
        $(NULL)
 
-test_numtohost_SOURCES =                  \
-       numtohost.c                       \
-       run-test-numtohost.c              \
+test_numtohost_SOURCES =               \
+       numtohost.c                     \
+       run-test-numtohost.c            \
        $(NULL)
 
-test_hextoint_SOURCES =                  \
-       hextoint.c                       \
-       run-test-hextoint.c              \
+test_hextoint_SOURCES =                        \
+       hextoint.c                      \
+       run-test-hextoint.c             \
        $(NULL)
 
-test_atoint_SOURCES =                  \
-       atoint.c                        \
-       run-test-atoint.c               \
+test_atoint_SOURCES =                  \
+       atoint.c                        \
+       run-test-atoint.c               \
        $(NULL)
 
-test_a_md5encrypt_SOURCES =                    \
-       a_md5encrypt.c                          \
-       run-test-a_md5encrypt.c                 \
+test_a_md5encrypt_SOURCES =            \
+       a_md5encrypt.c                  \
+       run-test-a_md5encrypt.c         \
        $(NULL)
 
-test_atouint_SOURCES =                         \
-       atouint.c                               \
-       run-test-atouint.c                      \
+test_atouint_SOURCES =                 \
+       atouint.c                       \
+       run-test-atouint.c              \
        $(NULL)
 
-test_authkeys_SOURCES =                        \
-       authkeys.c                              \
-       run-test-authkeys.c                     \
+test_authkeys_SOURCES =                        \
+       authkeys.c                      \
+       run-test-authkeys.c             \
        $(NULL)
 
-test_lfpfunc_SOURCES =                         \
-       lfpfunc.c                               \
-       run-test-lfpfunc.c                      \
+test_lfpfunc_SOURCES =                 \
+       lfpfunc.c                       \
+       run-test-lfpfunc.c              \
        $(NULL)
 
-test_vi64ops_SOURCES =                         \
-       vi64ops.c                               \
-       run-test-vi64ops.c                      \
+test_vi64ops_SOURCES =                 \
+       vi64ops.c                       \
+       run-test-vi64ops.c              \
        $(NULL)
 
-test_refnumtoa_SOURCES =               \
-       refnumtoa.c                     \
-       run-test-refnumtoa.c                    \
+test_refnumtoa_SOURCES =               \
+       refnumtoa.c                     \
+       run-test-refnumtoa.c            \
        $(NULL)
 
-test_calyearstart_SOURCES =                    \
-       calyearstart.c                  \
-       run-test-calyearstart.c                 \
-       test-libntp.c                           \
+test_calyearstart_SOURCES =            \
+       calyearstart.c                  \
+       run-test-calyearstart.c         \
+       test-libntp.c                   \
        $(NULL)
 
-test_clocktime_SOURCES =               \
-       clocktime.c                     \
-       run-test-clocktime.c                    \
-       test-libntp.c                           \
+test_clocktime_SOURCES =               \
+       clocktime.c                     \
+       run-test-clocktime.c            \
+       test-libntp.c                   \
        $(NULL)
 
-test_caljulian_SOURCES =               \
-       caljulian.c                     \
-       run-test-caljulian.c                    \
+test_caljulian_SOURCES =               \
+       caljulian.c                     \
+       run-test-caljulian.c            \
        test-libntp.c                   \
        $(NULL)
 
+BUILT_SOURCES +=                               \
+       $(srcdir)/run-test-a_md5encrypt.c       \
+       $(srcdir)/run-test-atoint.c             \
+       $(srcdir)/run-test-atouint.c            \
+       $(srcdir)/run-test-authkeys.c           \
+       $(srcdir)/run-test-caljulian.c          \
+       $(srcdir)/run-test-calyearstart.c       \
+       $(srcdir)/run-test-clocktime.c          \
+       $(srcdir)/run-test-hextoint.c           \
+       $(srcdir)/run-test-lfpfunc.c            \
+       $(srcdir)/run-test-libntp.c             \
+       $(srcdir)/run-test-modetoa.c            \
+       $(srcdir)/run-test-numtoa.c             \
+       $(srcdir)/run-test-numtohost.c          \
+       $(srcdir)/run-test-refnumtoa.c          \
+       $(srcdir)/run-test-statestr.c           \
+       $(srcdir)/run-test-uglydate.c           \
+       $(srcdir)/run-test-vi64ops.c            \
+       $(srcdir)/run-test-ymd2yd.c             \
+       $(NULL)
 
 $(srcdir)/run-test-modetoa.c: $(srcdir)/modetoa.c $(std_unity_list)
        $(run_unity) modetoa.c run-test-modetoa.c
index 789bd71bb70144424463d0d0341397299df8bf82..ba2b273ade171762a2ad13ef55a804d62c5fd937 100644 (file)
@@ -1,22 +1,15 @@
-//#include "libntptest.h"
-
 #include "config.h"
 
-
-//#include "ntp_stdlib.h" //test fail without this include
 #include "ntp_calendar.h"
 #include "unity.h"
-//#include "ntp_types.h"
 
 #include "test-libntp.h"
 
-
 #include <string.h>
-//#include <sstream>
 
 //added struct to calendar!
 
-char * CalendarToString(const struct calendar cal) { //&cal
+char * CalendarToString(const struct calendar cal) {
        char * ss = malloc (sizeof (char) * 100);
        
        char buffer[100] ="";
@@ -46,7 +39,7 @@ char * CalendarToString(const struct calendar cal) { //&cal
 }
 
 //tehnically boolean
-int IsEqual(const struct calendar expected, const struct calendar actual) { // &ex &act
+int IsEqual(const struct calendar expected, const struct calendar actual) {
        if (expected.year == actual.year &&
                (expected.yearday == actual.yearday ||
                 (expected.month == actual.month &&