1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 07:46:38 +02:00

core: add function string_get_common_bytes_count (issue #1877)

This commit is contained in:
Sébastien Helleu
2023-01-30 20:54:37 +01:00
parent 38ffac78f3
commit 69a635412d
3 changed files with 50 additions and 1 deletions
+23 -1
View File
@@ -2542,7 +2542,29 @@ TEST(CoreString, InputForBuffer)
/*
* Tests functions:
* string_levenshtein
* string_get_common_bytes_count
*/
TEST(CoreString, GetCommonBytesCount)
{
LONGS_EQUAL(0, string_get_common_bytes_count (NULL, NULL));
LONGS_EQUAL(0, string_get_common_bytes_count ("", NULL));
LONGS_EQUAL(0, string_get_common_bytes_count (NULL, ""));
LONGS_EQUAL(0, string_get_common_bytes_count ("", ""));
LONGS_EQUAL(1, string_get_common_bytes_count ("a", "a"));
LONGS_EQUAL(0, string_get_common_bytes_count ("a", "b"));
LONGS_EQUAL(3, string_get_common_bytes_count ("abc", "abc"));
LONGS_EQUAL(3, string_get_common_bytes_count ("abcdef", "fac"));
LONGS_EQUAL(4, string_get_common_bytes_count ("noël", "noïl"));
}
/*
* Tests functions:
* string_levenshtein
*/
TEST(CoreString, Levenshtein)