diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-08-20 21:20:33 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-08-20 21:20:33 +0200 |
commit | 608ec9f4834630a2a73a8d0292883cf6dd837622 (patch) | |
tree | 039291c39886fdc81fb8aa0c7c97ff03c66fda95 /tests/unit/gui/test-gui-nick.cpp | |
parent | 21dca71ee06d8fe4897f1348ce10ac483d8bcc5c (diff) | |
download | weechat-608ec9f4834630a2a73a8d0292883cf6dd837622.zip |
core: add values djb2_32 and sum_32 for option weechat.look.nick_color_hash (issue #1394)
Diffstat (limited to 'tests/unit/gui/test-gui-nick.cpp')
-rw-r--r-- | tests/unit/gui/test-gui-nick.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/tests/unit/gui/test-gui-nick.cpp b/tests/unit/gui/test-gui-nick.cpp index 198fecd61..fbf8cf425 100644 --- a/tests/unit/gui/test-gui-nick.cpp +++ b/tests/unit/gui/test-gui-nick.cpp @@ -58,22 +58,64 @@ TEST(GuiNick, NickHashColor) { config_file_option_set (config_color_chat_nick_colors, NICK_COLORS, 0); - config_file_option_set (config_look_nick_color_hash, "dbj2", 0); + /* test hash: djb2 */ + config_file_option_set (config_look_nick_color_hash, "djb2", 0); + + LONGS_EQUAL(0, gui_nick_hash_color (NULL)); + LONGS_EQUAL(0, gui_nick_hash_color ("")); LONGS_EQUAL(71, gui_nick_hash_color ("a")); LONGS_EQUAL(108, gui_nick_hash_color ("abc")); LONGS_EQUAL(146, gui_nick_hash_color ("abcdef")); LONGS_EQUAL(73, gui_nick_hash_color ("abcdefghi")); LONGS_EQUAL(170, gui_nick_hash_color ("abcdefghijklmnopqrstuvwxyz")); + LONGS_EQUAL(124, gui_nick_hash_color ("abcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyz")); LONGS_EQUAL(94, gui_nick_hash_color ("zzzzzz")); + /* test hash: sum */ config_file_option_set (config_look_nick_color_hash, "sum", 0); + LONGS_EQUAL(0, gui_nick_hash_color (NULL)); + LONGS_EQUAL(0, gui_nick_hash_color ("")); + + LONGS_EQUAL(97, gui_nick_hash_color ("a")); + LONGS_EQUAL(38, gui_nick_hash_color ("abc")); + LONGS_EQUAL(85, gui_nick_hash_color ("abcdef")); + LONGS_EQUAL(141, gui_nick_hash_color ("abcdefghi")); + LONGS_EQUAL(31, gui_nick_hash_color ("abcdefghijklmnopqrstuvwxyz")); + LONGS_EQUAL(62, gui_nick_hash_color ("abcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyz")); + LONGS_EQUAL(220, gui_nick_hash_color ("zzzzzz")); + + /* test hash: djb2_32 */ + config_file_option_set (config_look_nick_color_hash, "djb2_32", 0); + + LONGS_EQUAL(0, gui_nick_hash_color (NULL)); + LONGS_EQUAL(0, gui_nick_hash_color ("")); + + LONGS_EQUAL(71, gui_nick_hash_color ("a")); + LONGS_EQUAL(108, gui_nick_hash_color ("abc")); + LONGS_EQUAL(146, gui_nick_hash_color ("abcdef")); + LONGS_EQUAL(73, gui_nick_hash_color ("abcdefghi")); + LONGS_EQUAL(209, gui_nick_hash_color ("abcdefghijklmnopqrstuvwxyz")); + LONGS_EQUAL(116, gui_nick_hash_color ("abcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyz")); + LONGS_EQUAL(94, gui_nick_hash_color ("zzzzzz")); + + /* test hash: sum_32 */ + config_file_option_set (config_look_nick_color_hash, "sum_32", 0); + + LONGS_EQUAL(0, gui_nick_hash_color (NULL)); + LONGS_EQUAL(0, gui_nick_hash_color ("")); + LONGS_EQUAL(97, gui_nick_hash_color ("a")); LONGS_EQUAL(38, gui_nick_hash_color ("abc")); LONGS_EQUAL(85, gui_nick_hash_color ("abcdef")); LONGS_EQUAL(141, gui_nick_hash_color ("abcdefghi")); LONGS_EQUAL(31, gui_nick_hash_color ("abcdefghijklmnopqrstuvwxyz")); + LONGS_EQUAL(62, gui_nick_hash_color ("abcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyz")); LONGS_EQUAL(220, gui_nick_hash_color ("zzzzzz")); config_file_option_reset (config_color_chat_nick_colors, 0); |