diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-07 10:09:04 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-07 13:18:14 +0200 |
commit | 89fe540b531705d8455685173c692522e81cd134 (patch) | |
tree | 717a3b15ef5e7d254a2515371efac6d79329f527 /tests/unit/gui/test-gui-nicklist.cpp | |
parent | 40a68549b5d4d99c0083f15242aab7516a87871f (diff) | |
download | weechat-89fe540b531705d8455685173c692522e81cd134.zip |
core: add unique "id" in nicklist group and nick (issue #2081)
The id is a "long long" variable with the current time (microseconds
precision).
It is guaranteed to be unique for all groups and nicks inside the buffer, and
the same number is never used again in the same buffer, during the lifetime of
the process.
It persists and is unchanged after `/upgrade`.
Diffstat (limited to 'tests/unit/gui/test-gui-nicklist.cpp')
-rw-r--r-- | tests/unit/gui/test-gui-nicklist.cpp | 412 |
1 files changed, 412 insertions, 0 deletions
diff --git a/tests/unit/gui/test-gui-nicklist.cpp b/tests/unit/gui/test-gui-nicklist.cpp new file mode 100644 index 000000000..74e523816 --- /dev/null +++ b/tests/unit/gui/test-gui-nicklist.cpp @@ -0,0 +1,412 @@ +/* + * test-gui-nicklist.cpp - test nicklist 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 <https://www.gnu.org/licenses/>. + */ + +#include "CppUTest/TestHarness.h" + +extern "C" +{ +#include <string.h> +#include "src/gui/gui-buffer.h" +#include "src/gui/gui-nicklist.h" +} + +#define TEST_BUFFER_NAME "test" + +TEST_GROUP(GuiNicklist) +{ +}; + +/* + * Tests functions: + * gui_nicklist_send_signal + */ + +TEST(GuiNicklist, SendSignal) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_send_hsignal + */ + +TEST(GuiNicklist, SendHsignal) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_find_pos_group + */ + +TEST(GuiNicklist, FindPosGroup) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_insert_group_sorted + */ + +TEST(GuiNicklist, InsertGroupSorted) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_search_group_internal + */ + +TEST(GuiNicklist, SearchGroupInternal) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_search_group + */ + +TEST(GuiNicklist, SearchGroup) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_generate_id + */ + +TEST(GuiNicklist, GenerateId) +{ + struct t_gui_buffer *buffer; + long long id; + + buffer = gui_buffer_new (NULL, TEST_BUFFER_NAME, + NULL, NULL, NULL, + NULL, NULL, NULL); + CHECK(buffer); + + CHECK(buffer->nicklist_last_id_assigned == 0); + + id = gui_nicklist_generate_id (buffer); + CHECK(id > buffer->nicklist_last_id_assigned); + id = gui_buffer_generate_id (); + CHECK(id > buffer->nicklist_last_id_assigned); + id = gui_buffer_generate_id (); + CHECK(id > buffer->nicklist_last_id_assigned); + + gui_buffer_close (buffer); +} + +/* + * Tests functions: + * gui_nicklist_add_group_with_id + */ + +TEST(GuiNicklist, AddGroupWithId) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_add_group + */ + +TEST(GuiNicklist, AddGroup) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_find_pos_nick + */ + +TEST(GuiNicklist, FindPosNick) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_insert_nick_sorted + */ + +TEST(GuiNicklist, InsertNickSorted) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_search_nick + */ + +TEST(GuiNicklist, SearchNick) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_add_nick_with_id + */ + +TEST(GuiNicklist, AddNickWithId) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_add_nick + */ + +TEST(GuiNicklist, AddNick) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_remove_nick + */ + +TEST(GuiNicklist, RemoveNick) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_remove_group + */ + +TEST(GuiNicklist, RemoveGroup) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_remove_all + */ + +TEST(GuiNicklist, RemoveAll) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_get_next_item + */ + +TEST(GuiNicklist, GetNextItem) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_get_group_start + */ + +TEST(GuiNicklist, GetGroupStart) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_get_max_length + */ + +TEST(GuiNicklist, GetMaxLength) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_compute_visible_count + */ + +TEST(GuiNicklist, ComputeVisibleCount) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_group_get_integer + */ + +TEST(GuiNicklist, GroupGetInteger) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_group_get_string + */ + +TEST(GuiNicklist, GroupGetString) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_group_get_pointer + */ + +TEST(GuiNicklist, GroupGetPointer) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_group_set + */ + +TEST(GuiNicklist, GroupSet) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_nick_get_integer + */ + +TEST(GuiNicklist, NickGetInteger) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_nick_get_string + */ + +TEST(GuiNicklist, NickGetString) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_nick_get_pointer + */ + +TEST(GuiNicklist, NickGetPointer) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_nick_set + */ + +TEST(GuiNicklist, NickSet) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_hdata_nick_group_cb + */ + +TEST(GuiNicklist, HdataNickGroupCb) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_hdata_nick_cb + */ + +TEST(GuiNicklist, HdataNickCb) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_add_group_to_infolist + */ + +TEST(GuiNicklist, AddGroupToInfolist) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_add_nick_to_infolist + */ + +TEST(GuiNicklist, AddNickToInfolist) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_add_to_infolist + */ + +TEST(GuiNicklist, AddToInfolist) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_print_log + */ + +TEST(GuiNicklist, PrintLog) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * gui_nicklist_end + */ + +TEST(GuiNicklist, End) +{ + /* TODO: write tests */ +} |