summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-04-01 00:15:25 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-04-01 00:15:25 +0200
commit5d02ff9a6d28fedead688bc42c9e9619e3708ff2 (patch)
tree09a0d02a7f6952fe7058214671a207f3da2cfb29 /tests/unit
parentd2571ab53b97b5420f228476fdfb5b97062ebbcf (diff)
downloadweechat-5d02ff9a6d28fedead688bc42c9e9619e3708ff2.zip
tests: add tests on function util_signal_search
Diffstat (limited to 'tests/unit')
-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 */
}