diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-11-05 15:53:28 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-11-05 15:53:28 +0100 |
commit | 4daa57f6d139f51a62ea4bcffa738bd5035df33a (patch) | |
tree | ba767bbbf1c7153a12e3d9e866a079c30d1c69e0 /tests | |
parent | f89117b5cf36797b04291942b2f2494895fc58dd (diff) |
Support as many emoji as possible, using separate emoji images in text
Diffstat (limited to 'tests')
-rw-r--r-- | tests/main.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/main.cpp b/tests/main.cpp index 01f91a3..41ef45d 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,6 +1,8 @@ #include <stdio.h> +#include <string.h> #include "../include/NetUtils.hpp" -#include "../plugins/EpisodeNameParser.hpp" +#include "../plugins/utils/EpisodeNameParser.hpp" +#include "../generated/Emoji.hpp" #define assert_fail(str) do { fprintf(stderr, "Assert failed on line %d, reason: %s\n", __LINE__, (str)); exit(1); } while(0) #define assert_equals(a, b) do { if((a) != (b)) { fprintf(stderr, "Assert failed on line %d, %s == %s\n", __LINE__, #a, #b); exit(1); } } while(0) @@ -102,5 +104,13 @@ int main() { assert_equals(name_parts4->season, "Yuukaku-hen"); assert_equals(name_parts4->episode, "11"); + uint32_t emoji_sequence[32]; + size_t emoji_sequence_length = 0; + size_t emoji_sequence_byte_length = 0; + const char *emoji = "\xF0\x9F\x8F\xB4\xE2\x80\x8D\xE2\x98\xA0\xEF\xB8\x8F"; + assert_equals(match_emoji_sequence((const unsigned char*)emoji, strlen(emoji), emoji_sequence, emoji_sequence_length, emoji_sequence_byte_length), true); + assert_equals(emoji_sequence_length, 4); + assert_equals(emoji_sequence_byte_length, 13); + return 0; } |