1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 14:56:39 +02:00

tests: add tests on relay remote functions (issue #2066)

This commit is contained in:
Sébastien Helleu
2024-03-31 11:23:37 +02:00
parent a3f3c9d09c
commit f507be4128
6 changed files with 297 additions and 0 deletions
+1
View File
@@ -481,6 +481,7 @@ WeeChat "core" is located in following directories:
|          relay/ | Root of unit tests for Relay plugin.
|             test-relay-auth.cpp | Tests: clients authentication.
|             test-relay-http.cpp | Tests: HTTP functions for Relay plugin.
|             test-relay-remote.cpp | Tests: remote functions for Relay plugin.
|             test-relay-websocket.cpp | Tests: websocket functions for Relay plugin.
|             api/ | Root of unit tests for Relay "api" protocol.
|                test-relay-api.cpp | Tests: Relay "api" protocol: general functions.
+1
View File
@@ -483,6 +483,7 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
|          relay/ | Racine des tests unitaires pour l'extension Relay.
|             test-relay-auth.cpp | Tests : authentification des clients.
|             test-relay-http.cpp | Tests : fonctions HTTP pour l'extension Relay.
|             test-relay-remote.cpp | Tests : fonctions remote pour l'extension Relay.
|             test-relay-websocket.cpp | Tests : fonctions websocket pour l'extension Relay.
|             api/ | Racine des tests unitaires pour le protocole relay "api".
|                test-relay-api.cpp | Tests : protocole relay "api" : fonctions générales.
+2
View File
@@ -569,6 +569,8 @@ WeeChat "core" は以下のディレクトリに配置されています:
// TRANSLATION MISSING
|             test-relay-http.cpp | Tests: HTTP functions for Relay plugin.
// TRANSLATION MISSING
|             test-relay-remote.cpp | Tests: remote functions for Relay plugin.
// TRANSLATION MISSING
|             test-relay-websocket.cpp | Tests: websocket functions for Relay plugin.
// TRANSLATION MISSING
|             api/ | Root of unit tests for Relay "api" protocol.
+2
View File
@@ -489,6 +489,8 @@ WeeChat „језгро” се налази у следећим директо
|          relay/ | Корен unit тестова за Релеј додатак.
|             test-relay-auth.cpp | Тестови: аутентификација клијената.
|             test-relay-http.cpp | Тестови: HTTP функције за Релеј додатак.
// TRANSLATION MISSING
|             test-relay-remote.cpp | Tests: remote functions for Relay plugin.
|             test-relay-websocket.cpp | Тестови: websocket функције за Релеј додатак.
|             api/ | Root of unit tests for Relay "api" protocol.
|                test-relay-api.cpp | Tests: Relay "api" protocol: general functions.
+1
View File
@@ -135,6 +135,7 @@ if (ENABLE_RELAY)
list(APPEND LIB_WEECHAT_UNIT_TESTS_PLUGINS_SRC
unit/plugins/relay/test-relay-auth.cpp
unit/plugins/relay/test-relay-http.cpp
unit/plugins/relay/test-relay-remote.cpp
unit/plugins/relay/test-relay-websocket.cpp
unit/plugins/relay/irc/test-relay-irc.cpp
)
@@ -0,0 +1,290 @@
/*
* test-relay-remote.cpp - test relay remote functions
*
* Copyright (C) 2024 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CppUTest/TestHarness.h"
extern "C"
{
#include <stdio.h>
#include <string.h>
#include "src/plugins/relay/relay.h"
#include "src/plugins/relay/relay-remote.h"
extern char *relay_remote_get_address (const char *url);
}
TEST_GROUP(RelayRemote)
{
};
/*
* Tests functions:
* relay_remote_search_option
*/
TEST(RelayRemote, SearchOption)
{
LONGS_EQUAL(-1, relay_remote_search_option (NULL));
LONGS_EQUAL(-1, relay_remote_search_option (""));
LONGS_EQUAL(-1, relay_remote_search_option ("zzz"));
LONGS_EQUAL(0, relay_remote_search_option ("url"));
}
/*
* Tests functions:
* relay_remote_valid
*/
TEST(RelayRemote, Valid)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_search
*/
TEST(RelayRemote, Search)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_search_by_number
*/
TEST(RelayRemote, SearchByNumber)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_name_valid
*/
TEST(RelayRemote, NameValid)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_url_valid
*/
TEST(RelayRemote, UrlValid)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_send_signal
*/
TEST(RelayRemote, SendSignal)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_get_address
*/
TEST(RelayRemote, GetAddress)
{
POINTERS_EQUAL(NULL, relay_remote_get_address (NULL));
POINTERS_EQUAL(NULL, relay_remote_get_address (""));
POINTERS_EQUAL(NULL, relay_remote_get_address ("zzz"));
STRCMP_EQUAL("", relay_remote_get_address ("http://"));
STRCMP_EQUAL("", relay_remote_get_address ("https://"));
STRCMP_EQUAL("localhost", relay_remote_get_address ("https://localhost"));
STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com"));
STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com:8000"));
STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com:8000/"));
}
/*
* Tests functions:
* relay_remote_get_port
*/
TEST(RelayRemote, GetPort)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_alloc
*/
TEST(RelayRemote, Alloc)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_find_pos
*/
TEST(RelayRemote, FindPos)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_add
*/
TEST(RelayRemote, Add)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_new_with_options
*/
TEST(RelayRemote, NewWithOptions)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_new
*/
TEST(RelayRemote, New)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_new_with_infolist
*/
TEST(RelayRemote, NewWithInfolist)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_set_status
*/
TEST(RelayRemote, SetStatus)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_connect
*/
TEST(RelayRemote, Connect)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_rename
*/
TEST(RelayRemote, Rename)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_free
*/
TEST(RelayRemote, Free)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_free_all
*/
TEST(RelayRemote, FreeAll)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_disconnect
*/
TEST(RelayRemote, Disconnect)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_disconnect_all
*/
TEST(RelayRemote, DisconnectAll)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_add_to_infolist
*/
TEST(RelayRemote, AddToInfolist)
{
/* TODO: write tests */
}
/*
* Tests functions:
* relay_remote_print_log
*/
TEST(RelayRemote, PrintLog)
{
/* TODO: write tests */
}