|
Blender V5.0
|
#include "testing/testing.h"#include "BLI_rand.h"#include "BLI_string.h"#include "BLI_string_cursor_utf8.h"#include "BLI_string_utf8.h"#include "BLI_utildefines.h"Go to the source code of this file.
Macros | |
| #define | STR_MB_ALPHA_1 "\x41" |
| #define | STR_MB_ALPHA_2 "\xc2\xaa" |
| #define | STR_MB_ALPHA_3 "\xe0\xa0\x80" |
| #define | STR_MB_ALPHA_4 "\xf0\x90\x80\x80" |
| #define | STR_MB_ALPHA_5 "\xf8\x80\x80\x80\x80" |
| #define | STR_MB_ALPHA_6 "\xfc\x80\x80\x80\x80\x80" |
| #define | TEST_SIMPLE(src_chars, expected_error_count, expected_str) |
| #define | ARRAY_ARG(...) |
| #define | EXPECT_BYTE_OFFSET(truncate_ofs, expect_nchars) |
| #define | STRNCPY_UTF8_ASCII(...) |
| #define | STRNCPY_UTF8_ASCII_TRUNCATE(maxncpy, ...) |
| #define | STRNCPY_UTF8_TRUNCATE(byte_size, ...) |
| #define | STRNCPY_UTF8_TRUNC_EXPECT(src, dst_expect, dst_maxncpy) |
| #define | STRNCPY_UTF8_TERMINATE_EARLY(byte_size, ...) |
| #define | SNPRINTF_UTF8_ASCII(...) |
| #define | SNPRINTF_UTF8_TERMINATE_EARLY(byte_size, ...) |
| #define | SNPRINTF_UTF8_TRUNC_EXPECT(src, dst_expect, dst_maxncpy) |
Functions | |
Test #BLI_strnlen_utf8 | |
| TEST (string, StringNLenUTF8) | |
| TEST (string, StringNLenUTF8_Incomplete) | |
Test #BLI_strncpy_utf8 | |
| TEST (string, StrCopyUTF8_ASCII) | |
| TEST (string, StrCopyUTF8_ASCII_Truncate) | |
| TEST (string, StrCopyUTF8_TruncateEncoding) | |
| TEST (string, StrCopyUTF8_TruncateEncodingMulti) | |
| TEST (string, StrCopyUTF8_TerminateEncodingEarly) | |
Test #BLI_snprintf_utf8 | |
| TEST (string, StrPrintfUTF8_ASCII) | |
| TEST (string, StrPrintfUTF8_TerminateEncodingEarly) | |
| TEST (string, StrPrintfUTF8_TruncateEncodingMulti) | |
Test #BLI_str_utf8_offset_from_index | |
| TEST (string, Utf8OffsetFromIndex_ClampedIndex) | |
Test #BLI_str_utf8_as_unicode_step_safe | |
| static size_t | utf8_as_char32 (const char *str, const char str_len, char32_t *r_result) |
| template<size_t Size, size_t SizeWithPadding> | |
| void | utf8_as_char32_test_compare_with_pad_bytes (const char utf8_src[Size]) |
| template<size_t Size> | |
| void | utf8_as_char32_test_compare (const char utf8_src[Size]) |
| template<size_t Size> | |
| void | utf8_as_char32_test_at_buffer_size () |
| TEST (string, Utf8AsUnicodeStep) | |
Test #BLI_str_cursor_step_next_utf32_empty | |
| TEST (string, StrCursorStepNextUtf32Empty) | |
Test #BLI_str_cursor_step_next_utf32_single | |
| TEST (string, StrCursorStepNextUtf32Single) | |
Test #BLI_str_cursor_step_next_utf32_simple | |
| TEST (string, StrCursorStepNextUtf32Simple) | |
Test #BLI_str_cursor_step_next_utf32_allcombining | |
| TEST (string, StrCursorStepNextUtf32AllCombining) | |
Test #BLI_str_cursor_step_next_utf32_complex | |
| TEST (string, StrCursorStepNextUtf32Complex) | |
Test #BLI_str_cursor_step_next_utf32_invalid | |
| TEST (string, StrCursorStepNextUtf32Invalid) | |
Test #BLI_str_cursor_step_prev_utf32_empty | |
| TEST (string, StrCursorStepPrevUtf32Empty) | |
Test #BLI_str_cursor_step_prev_utf32_single | |
| TEST (string, StrCursorStepPrevUtf32Single) | |
Test #BLI_str_cursor_step_prev_utf32_simple | |
| TEST (string, StrCursorStepPrevUtf32Simple) | |
Test #BLI_str_cursor_step_prev_utf32_allcombining | |
| TEST (string, StrCursorStepPrevUtf32AllCombining) | |
Test #BLI_str_cursor_step_prev_utf32_complex | |
| TEST (string, StrCursorStepPrevUtf32Complex) | |
Test #BLI_str_cursor_step_prev_utf32_invalid | |
| TEST (string, StrCursorStepPrevUtf32Invalid) | |
Test #BLI_str_cursor_step_next_utf8_empty | |
| TEST (string, StrCursorStepNextUtf8Empty) | |
Test #BLI_str_cursor_step_next_utf8_single | |
| TEST (string, StrCursorStepNextUtf8Single) | |
Test #BLI_str_cursor_step_next_utf8_simple | |
| TEST (string, StrCursorStepNextUtf8Simple) | |
Test #BLI_str_cursor_step_next_utf8_allcombining | |
| TEST (string, StrCursorStepNextUtf8AllCombining) | |
Test #BLI_str_cursor_step_next_utf8_complex | |
| TEST (string, StrCursorStepNextUtf8AllComplex) | |
Test #BLI_str_cursor_step_next_utf8_invalid | |
| TEST (string, StrCursorStepNextUtf8Invalid) | |
Test #BLI_str_cursor_step_prev_utf8_empty | |
| TEST (string, StrCursorStepPrevUtf8Empty) | |
Test #BLI_str_cursor_step_prev_utf8_single | |
| TEST (string, StrCursorStepPrevUtf8Single) | |
| TEST (string, StrCursorStepPrevUtf8Simple) | |
Test #BLI_str_cursor_step_prev_utf8_allcombining | |
| TEST (string, StrCursorStepPrevUtf8AllCombining) | |
Test #BLI_str_cursor_step_prev_utf8_complex | |
| TEST (string, StrCursorStepPrevUtf8Complex) | |
Test #BLI_str_cursor_step_prev_utf8_invalid | |
| TEST (string, StrCursorStepPrevUtf8Invalid) | |
Test #BLI_str_utf8_invalid_strip | |
| static const char * | utf8_invalid_tests [][3] |
| TEST (string, Utf8InvalidBytesStrip) | |
| TEST (string, Utf8InvalidBytesSubstitute) | |
| TEST (string, Utf8InvalidBytesSubstitutePatterns) | |
| #define ARRAY_ARG | ( | ... | ) |
Referenced by TEST().
| #define EXPECT_BYTE_OFFSET | ( | truncate_ofs, | |
| expect_nchars ) |
Referenced by TEST().
| #define SNPRINTF_UTF8_ASCII | ( | ... | ) |
Referenced by TEST().
| #define SNPRINTF_UTF8_TERMINATE_EARLY | ( | byte_size, | |
| ... ) |
Referenced by TEST().
| #define SNPRINTF_UTF8_TRUNC_EXPECT | ( | src, | |
| dst_expect, | |||
| dst_maxncpy ) |
Referenced by TEST().
| #define STR_MB_ALPHA_1 "\x41" |
Multi byte defies, use when the exact character isn't important, and when proper handling of multi-byte sequences is needed.
Define the first text character found in 1-4 bytes. We might want to generate other string tables too.
Definition at line 52 of file BLI_string_utf8_test.cc.
| #define STR_MB_ALPHA_2 "\xc2\xaa" |
| #define STR_MB_ALPHA_3 "\xe0\xa0\x80" |
| #define STR_MB_ALPHA_4 "\xf0\x90\x80\x80" |
| #define STR_MB_ALPHA_5 "\xf8\x80\x80\x80\x80" |
Definition at line 61 of file BLI_string_utf8_test.cc.
| #define STR_MB_ALPHA_6 "\xfc\x80\x80\x80\x80\x80" |
| #define STRNCPY_UTF8_ASCII | ( | ... | ) |
Referenced by TEST().
| #define STRNCPY_UTF8_ASCII_TRUNCATE | ( | maxncpy, | |
| ... ) |
Referenced by TEST().
| #define STRNCPY_UTF8_TERMINATE_EARLY | ( | byte_size, | |
| ... ) |
Referenced by TEST().
| #define STRNCPY_UTF8_TRUNC_EXPECT | ( | src, | |
| dst_expect, | |||
| dst_maxncpy ) |
Referenced by TEST().
| #define STRNCPY_UTF8_TRUNCATE | ( | byte_size, | |
| ... ) |
Referenced by TEST().
| #define TEST_SIMPLE | ( | src_chars, | |
| expected_error_count, | |||
| expected_str ) |
Referenced by TEST().
| TEST | ( | string | , |
| StrCopyUTF8_ASCII | ) |
Definition at line 453 of file BLI_string_utf8_test.cc.
References STRNCPY_UTF8_ASCII.
| TEST | ( | string | , |
| StrCopyUTF8_ASCII_Truncate | ) |
Definition at line 471 of file BLI_string_utf8_test.cc.
References STRNCPY_UTF8_ASCII_TRUNCATE.
| TEST | ( | string | , |
| StrCopyUTF8_TerminateEncodingEarly | ) |
Definition at line 617 of file BLI_string_utf8_test.cc.
References STRNCPY_UTF8_TERMINATE_EARLY.
| TEST | ( | string | , |
| StrCopyUTF8_TruncateEncoding | ) |
Definition at line 491 of file BLI_string_utf8_test.cc.
References STRNCPY_UTF8_TRUNCATE.
| TEST | ( | string | , |
| StrCopyUTF8_TruncateEncodingMulti | ) |
Definition at line 517 of file BLI_string_utf8_test.cc.
References STR_MB_ALPHA_1, STR_MB_ALPHA_2, STR_MB_ALPHA_3, STR_MB_ALPHA_4, STR_MB_ALPHA_5, STR_MB_ALPHA_6, and STRNCPY_UTF8_TRUNC_EXPECT.
| TEST | ( | string | , |
| StrCursorStepNextUtf32AllCombining | ) |
Definition at line 945 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepNextUtf32Complex | ) |
Definition at line 965 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepNextUtf32Empty | ) |
Definition at line 895 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepNextUtf32Invalid | ) |
Definition at line 990 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepNextUtf32Simple | ) |
Definition at line 927 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepNextUtf32Single | ) |
Definition at line 911 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepNextUtf8AllCombining | ) |
Definition at line 1190 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf8(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepNextUtf8AllComplex | ) |
Definition at line 1216 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf8(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepNextUtf8Empty | ) |
Definition at line 1142 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf8(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepNextUtf8Invalid | ) |
Definition at line 1251 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf8(), EXPECT_EQ(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepNextUtf8Simple | ) |
Definition at line 1172 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf8(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepNextUtf8Single | ) |
Definition at line 1157 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_next_utf8(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepPrevUtf32AllCombining | ) |
Definition at line 1067 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepPrevUtf32Complex | ) |
Definition at line 1087 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepPrevUtf32Empty | ) |
Definition at line 1021 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepPrevUtf32Invalid | ) |
Definition at line 1112 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepPrevUtf32Simple | ) |
Definition at line 1050 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepPrevUtf32Single | ) |
Definition at line 1035 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf32(), len, pos, and U.
| TEST | ( | string | , |
| StrCursorStepPrevUtf8AllCombining | ) |
Definition at line 1330 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf8(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepPrevUtf8Complex | ) |
Definition at line 1356 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf8(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepPrevUtf8Empty | ) |
Definition at line 1282 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf8(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepPrevUtf8Invalid | ) |
Definition at line 1391 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf8(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepPrevUtf8Simple | ) |
Definition at line 1313 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf8(), len, and pos.
| TEST | ( | string | , |
| StrCursorStepPrevUtf8Single | ) |
Definition at line 1298 of file BLI_string_utf8_test.cc.
References BLI_str_cursor_step_prev_utf8(), len, and pos.
| TEST | ( | string | , |
| StringNLenUTF8 | ) |
Definition at line 393 of file BLI_string_utf8_test.cc.
References BLI_strnlen_utf8(), EXPECT_EQ(), and STR_MB_ALPHA_6.
| TEST | ( | string | , |
| StringNLenUTF8_Incomplete | ) |
Definition at line 400 of file BLI_string_utf8_test.cc.
References EXPECT_BYTE_OFFSET, STR_MB_ALPHA_1, STR_MB_ALPHA_2, STR_MB_ALPHA_3, STR_MB_ALPHA_4, STR_MB_ALPHA_5, and STR_MB_ALPHA_6.
| TEST | ( | string | , |
| StrPrintfUTF8_ASCII | ) |
Definition at line 656 of file BLI_string_utf8_test.cc.
References SNPRINTF_UTF8_ASCII.
| TEST | ( | string | , |
| StrPrintfUTF8_TerminateEncodingEarly | ) |
Definition at line 674 of file BLI_string_utf8_test.cc.
References SNPRINTF_UTF8_TERMINATE_EARLY.
| TEST | ( | string | , |
| StrPrintfUTF8_TruncateEncodingMulti | ) |
Definition at line 707 of file BLI_string_utf8_test.cc.
References SNPRINTF_UTF8_TRUNC_EXPECT, STR_MB_ALPHA_1, STR_MB_ALPHA_2, STR_MB_ALPHA_3, STR_MB_ALPHA_4, STR_MB_ALPHA_5, and STR_MB_ALPHA_6.
| TEST | ( | string | , |
| Utf8AsUnicodeStep | ) |
Definition at line 871 of file BLI_string_utf8_test.cc.
References utf8_as_char32_test_at_buffer_size().
| TEST | ( | string | , |
| Utf8InvalidBytesStrip | ) |
Definition at line 322 of file BLI_string_utf8_test.cc.
References BLI_str_utf8_invalid_strip(), EXPECT_EQ(), i, printf, and utf8_invalid_tests.
| TEST | ( | string | , |
| Utf8InvalidBytesSubstitute | ) |
Definition at line 341 of file BLI_string_utf8_test.cc.
References BLI_str_utf8_invalid_byte(), BLI_str_utf8_invalid_substitute(), EXPECT_EQ(), i, and utf8_invalid_tests.
| TEST | ( | string | , |
| Utf8InvalidBytesSubstitutePatterns | ) |
Definition at line 358 of file BLI_string_utf8_test.cc.
References ARRAY_ARG, and TEST_SIMPLE.
| TEST | ( | string | , |
| Utf8OffsetFromIndex_ClampedIndex | ) |
Definition at line 762 of file BLI_string_utf8_test.cc.
References ARRAY_SIZE, BLI_str_utf8_offset_from_index(), BLI_strlen_utf8(), EXPECT_EQ(), i, str, STR_MB_ALPHA_1, STR_MB_ALPHA_2, STR_MB_ALPHA_3, and STR_MB_ALPHA_4.
|
static |
Definition at line 793 of file BLI_string_utf8_test.cc.
References BLI_str_utf8_as_unicode_step_safe(), i, and str.
Referenced by utf8_as_char32_test_compare_with_pad_bytes().
| void utf8_as_char32_test_at_buffer_size | ( | ) |
Definition at line 837 of file BLI_string_utf8_test.cc.
References BLI_rng_free(), BLI_rng_get_char_n(), BLI_rng_new(), i, mul(), and utf8_as_char32_test_compare().
Referenced by TEST().
| void utf8_as_char32_test_compare | ( | const char | utf8_src[Size] | ) |
Definition at line 828 of file BLI_string_utf8_test.cc.
References utf8_as_char32_test_compare_with_pad_bytes().
Referenced by utf8_as_char32_test_at_buffer_size().
| void utf8_as_char32_test_compare_with_pad_bytes | ( | const char | utf8_src[Size] | ) |
Definition at line 803 of file BLI_string_utf8_test.cc.
References EXPECT_EQ(), and utf8_as_char32().
Referenced by utf8_as_char32_test_compare().
|
static |
Definition at line 77 of file BLI_string_utf8_test.cc.