disabled for now, very trick to test static functions.
run-t-ntpq.c:
update
ntp_scanner.c:
added new test
Makefile.am:
added more include dirs
bk: 55d5e5b1Gj-SA6whoaZsjQFewTRQgQ
#include "ntp_scanner.h"
//#include "ntp_parser.h"
+
/* ntp_keyword.h declares finite state machine and token text */
//#include "ntp_keyword.h"
void test_InitializeLexStack(void){
//Some sort of server is required for this to work.
- //sockaddr_u * remote_addr
- //char origin[128];
+ sockaddr_u * remote_addr;
+ char origin[128] ={ "" } ;
+ strcat(origin,"127.0.0.1");
//snprintf(origin, sizeof(origin), "remote config from %s", stoa(remote_addr));
- //TEST_ASSERT_TRUE(lex_init_stack(origin,NULL)); //path, mode -> NULL is ok!
+ TEST_ASSERT_TRUE(lex_init_stack(origin,NULL)); //path, mode -> NULL is ok!
lex_drop_stack();
}
+
+void test_PopEmptyStack(void){
+ int temp = lex_pop_file();
+
+ TEST_ASSERT_FALSE(temp);
+}
AM_CPPFLAGS = $(NTP_INCS)
AM_CPPFLAGS += -I$(top_srcdir)/ntpq
-#AM_CPPFLAGS += -I$(top_srcdir)/sntp
-#AM_CPPFLAGS += -I$(top_srcdir)/ntpd
-#AM_CPPFLAGS += -I$(top_srcdir)/tests/libntp
+AM_CPPFLAGS += -I$(top_srcdir)/sntp
+AM_CPPFLAGS += -I$(top_srcdir)/sntp/libopts
AM_CPPFLAGS += $(CPPFLAGS_NTP)
AM_CPPFLAGS += -DUNITY_INCLUDE_CONFIG_H
AM_CPPFLAGS += -I$(top_srcdir)/sntp/unity
#include <stdio.h>
#include "config.h"
#include "ntp.h"
-#include "ntp_stdlib.h"
#include "ntpq.h"
//=======External Functions This Runner Calls=====
{
progname = argv[0];
UnityBegin("t-ntpq.c");
- RUN_TEST(testPrimary, 9);
+ RUN_TEST(testPrimary, 20);
return (UnityEnd());
}
#include "config.h"
#include "ntp.h"
-#include "ntp_stdlib.h"
+//#include "ntp_stdlib.h"
+
+
+//#include "ntp_calendar.h"
#include "unity.h"
#include "ntpq.h"
+//very tricky to test static functions. It might be a good idea to use cmock here
+//#define HAVE_NTPQ
+//#include "ntpq.c"
+
+
+
+//extern int main(int argc, char *argv[]);
+
void testPrimary(void);
void testPrimary(void){
+ //main(NULL,NULL);
+/*
+ char ** tokens;
+ int * num = 0;
+ tokenize("a bc de1 234",tokens, num);
+*/
+}
-}
+
+
+
+
+
+#define HAVE_NTP_SIGND