]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
run-ntp_scanner.c, ntp_scanner.c:
authorDamir Tomic <viperus@ntp.org>
Sun, 26 Jul 2015 19:48:29 +0000 (21:48 +0200)
committerDamir Tomic <viperus@ntp.org>
Sun, 26 Jul 2015 19:48:29 +0000 (21:48 +0200)
  new file

bk: 55b5398dhhumj2O71Gb0SgX_rFF2_g

tests/ntpd/ntp_scanner.c [new file with mode: 0644]
tests/ntpd/run-ntp_scanner.c [new file with mode: 0644]

diff --git a/tests/ntpd/ntp_scanner.c b/tests/ntpd/ntp_scanner.c
new file mode 100644 (file)
index 0000000..b1f52b0
--- /dev/null
@@ -0,0 +1,29 @@
+#include "config.h"
+
+#include "unity.h"
+
+//#include <stdio.h>
+//#include <ctype.h>
+//#include <stdlib.h>
+//#include <errno.h>
+//#include <string.h>
+
+//#include "ntpd.h"
+//#include "ntp_config.h"
+//#include "ntpsim.h"
+#include "ntp_scanner.h"
+//#include "ntp_parser.h"
+
+/* ntp_keyword.h declares finite state machine and token text */
+//#include "ntp_keyword.h"
+
+void test_keywordIncorrectToken(void){
+       char * temp = keyword(999);
+       printf("%s",temp);
+}
+
+void test_keywordServerToken(void){
+       char * temp = keyword(401);
+       printf("%s",temp); //143 or 401 ?
+
+}
diff --git a/tests/ntpd/run-ntp_scanner.c b/tests/ntpd/run-ntp_scanner.c
new file mode 100644 (file)
index 0000000..35d2598
--- /dev/null
@@ -0,0 +1,55 @@
+/* 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>
+#include "config.h"
+#include "ntp_scanner.h"
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_keywordIncorrectToken(void);
+extern void test_keywordServerToken(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+  tearDown();
+  setUp();
+}
+
+char *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+  progname = argv[0];
+  UnityBegin("ntp_scanner.c");
+  RUN_TEST(test_keywordIncorrectToken, 20);
+  RUN_TEST(test_keywordServerToken, 25);
+
+  return (UnityEnd());
+}