summaryrefslogtreecommitdiff
path: root/tests/unit/core/test-core-util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/core/test-core-util.cpp')
-rw-r--r--tests/unit/core/test-core-util.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/tests/unit/core/test-core-util.cpp b/tests/unit/core/test-core-util.cpp
index c4ff4980e..bf0e65edd 100644
--- a/tests/unit/core/test-core-util.cpp
+++ b/tests/unit/core/test-core-util.cpp
@@ -26,6 +26,7 @@ extern "C"
#include <unistd.h>
#include <stdio.h>
#include <string.h>
+#include <signal.h>
#include <sys/time.h>
#include "src/core/wee-util.h"
}
@@ -155,10 +156,45 @@ TEST(CoreUtil, ParseDelay)
/*
* Tests functions:
* util_signal_search
+ */
+
+TEST(CoreUtil, SignalSearch)
+{
+ int count;
+
+ /* make tests fail if the util_signals structure is changed */
+ for (count = 0; util_signals[count].name; count++)
+ {
+ }
+ LONGS_EQUAL(7, count);
+
+ LONGS_EQUAL(-1, util_signal_search (NULL));
+ LONGS_EQUAL(-1, util_signal_search (""));
+ LONGS_EQUAL(-1, util_signal_search ("signal_does_not_exist"));
+
+ LONGS_EQUAL(SIGHUP, util_signal_search ("hup"));
+ LONGS_EQUAL(SIGINT, util_signal_search ("int"));
+ LONGS_EQUAL(SIGQUIT, util_signal_search ("quit"));
+ LONGS_EQUAL(SIGKILL, util_signal_search ("kill"));
+ LONGS_EQUAL(SIGTERM, util_signal_search ("term"));
+ LONGS_EQUAL(SIGUSR1, util_signal_search ("usr1"));
+ LONGS_EQUAL(SIGUSR2, util_signal_search ("usr2"));
+
+ LONGS_EQUAL(SIGHUP, util_signal_search ("HUP"));
+ LONGS_EQUAL(SIGINT, util_signal_search ("INT"));
+ LONGS_EQUAL(SIGQUIT, util_signal_search ("QUIT"));
+ LONGS_EQUAL(SIGKILL, util_signal_search ("KILL"));
+ LONGS_EQUAL(SIGTERM, util_signal_search ("TERM"));
+ LONGS_EQUAL(SIGUSR1, util_signal_search ("USR1"));
+ LONGS_EQUAL(SIGUSR2, util_signal_search ("USR2"));
+}
+
+/*
+ * Tests functions:
* util_catch_signal
*/
-TEST(CoreUtil, Signal)
+TEST(CoreUtil, CatchSignal)
{
/* TODO: write tests */
}