| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
|
|
| #include <config.h> |
|
|
| #if GNULIB_TEST_UNINORM_U32_NORMALIZE |
|
|
| #include "uninorm.h" |
|
|
| #include <stdlib.h> |
|
|
| #include "unistr.h" |
| #include "test-u32-normalize-big.h" |
| #include "macros.h" |
|
|
| static int |
| check (const uint32_t *c1, size_t c1_length, |
| const uint32_t *c2, size_t c2_length, |
| const uint32_t *c3, size_t c3_length, |
| const uint32_t *c4, size_t c4_length, |
| const uint32_t *c5, size_t c5_length) |
| { |
| |
| |
| |
| |
| { |
| size_t length; |
| uint32_t *result; |
|
|
| result = u32_normalize (UNINORM_NFD, c1, c1_length, NULL, &length); |
| if (!(result != NULL |
| && length == c3_length |
| && u32_cmp (result, c3, c3_length) == 0)) |
| return 1; |
| free (result); |
| } |
| { |
| size_t length; |
| uint32_t *result; |
|
|
| result = u32_normalize (UNINORM_NFD, c2, c2_length, NULL, &length); |
| if (!(result != NULL |
| && length == c3_length |
| && u32_cmp (result, c3, c3_length) == 0)) |
| return 2; |
| free (result); |
| } |
| { |
| size_t length; |
| uint32_t *result; |
|
|
| result = u32_normalize (UNINORM_NFD, c3, c3_length, NULL, &length); |
| if (!(result != NULL |
| && length == c3_length |
| && u32_cmp (result, c3, c3_length) == 0)) |
| return 3; |
| free (result); |
| } |
| { |
| size_t length; |
| uint32_t *result; |
|
|
| result = u32_normalize (UNINORM_NFD, c4, c4_length, NULL, &length); |
| if (!(result != NULL |
| && length == c5_length |
| && u32_cmp (result, c5, c5_length) == 0)) |
| return 4; |
| free (result); |
| } |
| { |
| size_t length; |
| uint32_t *result; |
|
|
| result = u32_normalize (UNINORM_NFD, c5, c5_length, NULL, &length); |
| if (!(result != NULL |
| && length == c5_length |
| && u32_cmp (result, c5, c5_length) == 0)) |
| return 5; |
| free (result); |
| } |
| return 0; |
| } |
|
|
| int |
| main (int argc, char *argv[]) |
| { |
| struct normalization_test_file file; |
|
|
| read_normalization_test_file (argv[1], &file); |
|
|
| test_specific (&file, check); |
| test_other (&file, UNINORM_NFD); |
|
|
| free_normalization_test_file (&file); |
|
|
| return test_exit_status; |
| } |
|
|
| #else |
|
|
| #include <stdio.h> |
|
|
| int |
| main () |
| { |
| fprintf (stderr, "Skipping test: uninorm/u32-normalize module not included.\n"); |
| return 77; |
| } |
|
|
| #endif |
|
|