summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-03-04 21:44:46 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-03-04 21:44:46 +0100
commitdc779b51799fcbc431a94ee5a814b6f86f8069ed (patch)
treeb6a5ca467e8dc02a713806f4400235a3815e9484 /tests/unit
parent7228262591af4d88a57a781152248bf9f1a60360 (diff)
downloadweechat-dc779b51799fcbc431a94ee5a814b6f86f8069ed.zip
tests: add tests on functions irc_server_search and irc_server_casesearch
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/plugins/irc/test-irc-server.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/tests/unit/plugins/irc/test-irc-server.cpp b/tests/unit/plugins/irc/test-irc-server.cpp
index cf5c41624..0a411a703 100644
--- a/tests/unit/plugins/irc/test-irc-server.cpp
+++ b/tests/unit/plugins/irc/test-irc-server.cpp
@@ -56,7 +56,21 @@ TEST(IrcServer, Valid)
TEST(IrcServer, Search)
{
- /* TODO: write tests */
+ struct t_irc_server *server1, *server2;
+
+ server1 = irc_server_alloc ("srv1");
+ server2 = irc_server_alloc ("abc");
+
+ POINTERS_EQUAL(NULL, irc_server_search (NULL));
+ POINTERS_EQUAL(NULL, irc_server_search ("does_not_exist"));
+ POINTERS_EQUAL(NULL, irc_server_search ("SRV1"));
+ POINTERS_EQUAL(NULL, irc_server_search ("ABC"));
+
+ POINTERS_EQUAL(server1, irc_server_search ("srv1"));
+ POINTERS_EQUAL(server2, irc_server_search ("abc"));
+
+ irc_server_free (server1);
+ irc_server_free (server2);
}
/*
@@ -66,7 +80,22 @@ TEST(IrcServer, Search)
TEST(IrcServer, CaseSearch)
{
- /* TODO: write tests */
+ struct t_irc_server *server1, *server2;
+
+ server1 = irc_server_alloc ("srv1");
+ server2 = irc_server_alloc ("abc");
+
+ POINTERS_EQUAL(NULL, irc_server_casesearch (NULL));
+ POINTERS_EQUAL(NULL, irc_server_casesearch ("does_not_exist"));
+
+ POINTERS_EQUAL(server1, irc_server_casesearch ("SRV1"));
+ POINTERS_EQUAL(server2, irc_server_casesearch ("ABC"));
+
+ POINTERS_EQUAL(server1, irc_server_casesearch ("srv1"));
+ POINTERS_EQUAL(server2, irc_server_casesearch ("abc"));
+
+ irc_server_free (server1);
+ irc_server_free (server2);
}
/*