summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/sntp/tests/kodDatabase.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/sntp/tests/kodDatabase.c')
-rw-r--r--contrib/ntp/sntp/tests/kodDatabase.c73
1 files changed, 43 insertions, 30 deletions
diff --git a/contrib/ntp/sntp/tests/kodDatabase.c b/contrib/ntp/sntp/tests/kodDatabase.c
index a6b86d0..0c3615d 100644
--- a/contrib/ntp/sntp/tests/kodDatabase.c
+++ b/contrib/ntp/sntp/tests/kodDatabase.c
@@ -4,24 +4,29 @@
#include "sntptest.h"
#include "ntp_stdlib.h"
#include "sntp-opts.h"
-
#include "kod_management.h"
+#include "ntp_io.h"
#include "unity.h"
-void setUp(void)
-{
- kod_init_kod_db("/dev/null", TRUE);
-}
+void setUp(void);
+void test_SingleEntryHandling(void);
+void test_MultipleEntryHandling(void);
+void test_NoMatchInSearch(void);
+void test_AddDuplicate(void);
+void test_DeleteEntry(void);
-void tearDown(void)
-{
+
+void
+setUp(void) {
+ kod_init_kod_db("/dev/null", TRUE);
}
-void test_SingleEntryHandling() {
- char HOST[] = "192.0.2.5";
- char REASON[] = "DENY";
+void
+test_SingleEntryHandling(void) {
+ const char HOST[] = "192.0.2.5";
+ const char REASON[] = "DENY";
add_entry(HOST, REASON);
@@ -32,15 +37,17 @@ void test_SingleEntryHandling() {
TEST_ASSERT_EQUAL_STRING(REASON, result->type);
}
-void test_MultipleEntryHandling() {
- char HOST1[] = "192.0.2.3";
- char REASON1[] = "DENY";
- char HOST2[] = "192.0.5.5";
- char REASON2[] = "RATE";
+void
+test_MultipleEntryHandling(void) {
+ const char HOST1[] = "192.0.2.3";
+ const char REASON1[] = "DENY";
- char HOST3[] = "192.0.10.1";
- char REASON3[] = "DENY";
+ const char HOST2[] = "192.0.5.5";
+ const char REASON2[] = "RATE";
+
+ const char HOST3[] = "192.0.10.1";
+ const char REASON3[] = "DENY";
add_entry(HOST1, REASON1);
add_entry(HOST2, REASON2);
@@ -63,10 +70,12 @@ void test_MultipleEntryHandling() {
free(result);
}
-void test_NoMatchInSearch() {
- char HOST_ADD[] = "192.0.2.6";
- char HOST_NOTADD[] = "192.0.6.1";
- char REASON[] = "DENY";
+
+void
+test_NoMatchInSearch(void) {
+ const char HOST_ADD[] = "192.0.2.6";
+ const char HOST_NOTADD[] = "192.0.6.1";
+ const char REASON[] = "DENY";
add_entry(HOST_ADD, REASON);
@@ -76,10 +85,12 @@ void test_NoMatchInSearch() {
TEST_ASSERT_TRUE(result == NULL);
}
-void test_AddDuplicate() {
- char HOST[] = "192.0.2.3";
- char REASON1[] = "RATE";
- char REASON2[] = "DENY";
+
+void
+test_AddDuplicate(void) {
+ const char HOST[] = "192.0.2.3";
+ const char REASON1[] = "RATE";
+ const char REASON2[] = "DENY";
add_entry(HOST, REASON1);
struct kod_entry* result1;
@@ -101,11 +112,13 @@ void test_AddDuplicate() {
free(result2);
}
-void test_DeleteEntry() {
- char HOST1[] = "192.0.2.1";
- char HOST2[] = "192.0.2.2";
- char HOST3[] = "192.0.2.3";
- char REASON[] = "DENY";
+
+void
+test_DeleteEntry(void) {
+ const char HOST1[] = "192.0.2.1";
+ const char HOST2[] = "192.0.2.2";
+ const char HOST3[] = "192.0.2.3";
+ const char REASON[] = "DENY";
add_entry(HOST1, REASON);
add_entry(HOST2, REASON);
OpenPOWER on IntegriCloud