diff options
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; } |