diff options
author | Manuel A. Fernandez Montecelo <manuel.montezelo@gmail.com> | 2016-05-27 14:28:30 +0100 |
---|---|---|
committer | Manuel A. Fernandez Montecelo <manuel.montezelo@gmail.com> | 2016-05-27 14:28:30 +0100 |
commit | a9a31b1de5776a3b08a82101a4fa711294f0dd1d (patch) | |
tree | 159134a624e51509f40ed8823249f09a70d1dda3 /tests/unistr | |
parent | 5f2b09982312c98863eb9a8dfe2c608b81f58259 (diff) |
Imported Upstream version 0.9.6+really0.9.3upstream/0.9.6+really0.9.3
Diffstat (limited to 'tests/unistr')
131 files changed, 139 insertions, 1347 deletions
diff --git a/tests/unistr/test-chr.h b/tests/unistr/test-chr.h index cd5a45e6..5a021c2d 100644 --- a/tests/unistr/test-chr.h +++ b/tests/unistr/test-chr.h @@ -1,5 +1,5 @@ /* Test of uN_chr() functions. - Copyright (C) 2008-2015 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,65 +19,32 @@ int main (void) { - size_t size = 0x100000; - size_t i; - size_t length; - UNIT *input; - uint32_t *input32 = (uint32_t *) malloc (size * sizeof (uint32_t)); - ASSERT (input32); - - input32[0] = 'a'; - input32[1] = 'b'; - u32_set (input32 + 2, 'c', 1024); - for (i = 1026; i < size - 2; i += 63) - { - size_t last = i + 63 < size - 2 ? i + 63 : size - 2; - ucs4_t uc = 'd' | (i - 1026); - if (uc >= 0xd800 && uc <= 0xdfff) - uc |= 0x100000; - u32_set (input32 + i, uc, last - i); - } - - input32[size - 2] = 'e'; - input32[size - 1] = 'a'; - - input = U32_TO_U (input32, size, NULL, &length); + size_t n = 0x100000; + UNIT *input = (UNIT *) malloc (n * sizeof (UNIT)); ASSERT (input); + input[0] = 'a'; + input[1] = 'b'; + U_SET (input + 2, 'c', 1024); + U_SET (input + 1026, 'd', n - 1028); + input[n - 2] = 'e'; + input[n - 1] = 'a'; + /* Basic behavior tests. */ - ASSERT (U_CHR (input, length, 'a') == input); + ASSERT (U_CHR (input, n, 'a') == input); ASSERT (U_CHR (input, 0, 'a') == NULL); ASSERT (U_CHR (zerosize_ptr (), 0, 'a') == NULL); - ASSERT (U_CHR (input, length, 'b') == input + 1); - ASSERT (U_CHR (input, length, 'c') == input + 2); - ASSERT (U_CHR (input, length, 'd') == input + 1026); - - { - UNIT *exp = input + 1026; - UNIT *prev = input + 1; - for (i = 1026; i < size - 2; i += 63) - { - UNIT c[6]; - size_t n; - ucs4_t uc = 'd' | (i - 1026); - if (uc >= 0xd800 && uc <= 0xdfff) - uc |= 0x100000; - n = U_UCTOMB (c, uc, 6); - ASSERT (exp < input + length - 1); - ASSERT (U_CHR (prev, (length - 1) - (prev - input), uc) == exp); - ASSERT (memcmp (exp, c, n * sizeof (UNIT)) == 0); - prev = exp; - exp += n * 63; - } - } + ASSERT (U_CHR (input, n, 'b') == input + 1); + ASSERT (U_CHR (input, n, 'c') == input + 2); + ASSERT (U_CHR (input, n, 'd') == input + 1026); - ASSERT (U_CHR (input + 1, length - 1, 'a') == input + length - 1); - ASSERT (U_CHR (input + 1, length - 1, 'e') == input + length - 2); + ASSERT (U_CHR (input + 1, n - 1, 'a') == input + n - 1); + ASSERT (U_CHR (input + 1, n - 1, 'e') == input + n - 2); - ASSERT (U_CHR (input, length, 'f') == NULL); - ASSERT (U_CHR (input, length, '\0') == NULL); + ASSERT (U_CHR (input, n, 'f') == NULL); + ASSERT (U_CHR (input, n, '\0') == NULL); /* Check that a very long haystack is handled quickly if the byte is found near the beginning. */ @@ -85,7 +52,7 @@ main (void) size_t repeat = 10000; for (; repeat > 0; repeat--) { - ASSERT (U_CHR (input, length, 'c') == input + 2); + ASSERT (U_CHR (input, n, 'c') == input + 2); } } @@ -107,7 +74,6 @@ main (void) byte being searched. */ { char *page_boundary = (char *) zerosize_ptr (); - size_t n; if (page_boundary != NULL) { diff --git a/tests/unistr/test-cmp.h b/tests/unistr/test-cmp.h index aece9b0e..e536f482 100644 --- a/tests/unistr/test-cmp.h +++ b/tests/unistr/test-cmp.h @@ -1,5 +1,5 @@ /* Test of uN_cmp() functions. - Copyright (C) 2008-2015 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-cmp2.h b/tests/unistr/test-cmp2.h index c4050994..261fe365 100644 --- a/tests/unistr/test-cmp2.h +++ b/tests/unistr/test-cmp2.h @@ -1,5 +1,5 @@ /* Test of uN_cmp2() functions. - Copyright (C) 2008-2015 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-cpy-alloc.h b/tests/unistr/test-cpy-alloc.h index 261a677b..795e0b77 100644 --- a/tests/unistr/test-cpy-alloc.h +++ b/tests/unistr/test-cpy-alloc.h @@ -1,5 +1,5 @@ /* Test of uN_cpy_alloc() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-cpy.h b/tests/unistr/test-cpy.h index bc8fe539..b62fd14f 100644 --- a/tests/unistr/test-cpy.h +++ b/tests/unistr/test-cpy.h @@ -1,5 +1,5 @@ /* Test of uN_cpy() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-move.h b/tests/unistr/test-move.h index d2c39211..2462367d 100644 --- a/tests/unistr/test-move.h +++ b/tests/unistr/test-move.h @@ -1,5 +1,5 @@ /* Test of uN_move() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-set.h b/tests/unistr/test-set.h index 8d366363..56924dc3 100644 --- a/tests/unistr/test-set.h +++ b/tests/unistr/test-set.h @@ -1,5 +1,5 @@ /* Test of uN_set() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-stpcpy.h b/tests/unistr/test-stpcpy.h index a9248539..76065dc4 100644 --- a/tests/unistr/test-stpcpy.h +++ b/tests/unistr/test-stpcpy.h @@ -1,5 +1,5 @@ /* Test of uN_stpcpy() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-stpncpy.h b/tests/unistr/test-stpncpy.h index 3cb2958d..bb81ff00 100644 --- a/tests/unistr/test-stpncpy.h +++ b/tests/unistr/test-stpncpy.h @@ -1,5 +1,5 @@ /* Test of uN_stpncpy() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-strcat.h b/tests/unistr/test-strcat.h index e454e93e..6c1f90dc 100644 --- a/tests/unistr/test-strcat.h +++ b/tests/unistr/test-strcat.h @@ -1,5 +1,5 @@ /* Test of uN_strcat() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-strchr.h b/tests/unistr/test-strchr.h deleted file mode 100644 index 191d74e3..00000000 --- a/tests/unistr/test-strchr.h +++ /dev/null @@ -1,161 +0,0 @@ -/* Test of uN_strchr() functions. - Copyright (C) 2008-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini <bonzini@gnu.org>, 2010. - Based on test-chr.h, by Eric Blake and Bruno Haible. */ - -static void -test_strchr (void) -{ - size_t size = 0x100000; - size_t length; - size_t i; - UNIT *input; - uint32_t *input32 = (uint32_t *) malloc ((size + 1) * sizeof (uint32_t)); - ASSERT (input32); - - input32[0] = 'a'; - input32[1] = 'b'; - u32_set (input32 + 2, 'c', 1024); - for (i = 1026; i < size - 2; i += 63) - { - size_t last = i + 63 < size - 2 ? i + 63 : size - 2; - ucs4_t uc = 'd' | (i - 1026); - if (uc >= 0xd800 && uc <= 0xdfff) - uc |= 0x100000; - u32_set (input32 + i, uc, last - i); - } - input32[size - 2] = 'e'; - input32[size - 1] = 'a'; - input32[size] = 0; - - input = U32_TO_U (input32, size + 1, NULL, &length); - ASSERT (input); - - /* Basic behavior tests. */ - ASSERT (U_STRCHR (input, 'a') == input); - ASSERT (U_STRCHR (input, 'b') == input + 1); - ASSERT (U_STRCHR (input, 'c') == input + 2); - - { - UNIT *exp = input + 1026; - UNIT *prev = input + 2; - - for (i = 1026; i < size - 2; i += 63) - { - UNIT c[6]; - size_t n; - ucs4_t uc = 'd' | (i - 1026); - if (uc >= 0xd800 && uc <= 0xdfff) - uc |= 0x100000; - n = U_UCTOMB (c, uc, 6); - ASSERT (exp < input + length - 2); - ASSERT (U_STRCHR (prev, uc) == exp); - ASSERT (memcmp (exp, c, n * sizeof (UNIT)) == 0); - prev = exp; - exp += n * 63; - } - } - - ASSERT (U_STRCHR (input + 1, 'a') == input + length - 2); - ASSERT (U_STRCHR (input + 1, 'e') == input + length - 3); - - ASSERT (U_STRCHR (input, 'f') == NULL); - ASSERT (U_STRCHR (input, '\0') == input + length - 1); - - /* Check that a very long haystack is handled quickly if the byte is - found near the beginning. */ - { - size_t repeat = 10000; - for (; repeat > 0; repeat--) - { - ASSERT (U_STRCHR (input, 'c') == input + 2); - } - } - - /* Alignment tests. */ - { - int i, j; - for (i = 0; i < 32; i++) - { - for (j = 0; j < 127; j++) - input[i + j] = j + 1; - input[i + 128] = 0; - for (j = 0; j < 127; j++) - { - ASSERT (U_STRCHR (input + i, j + 1) == input + i + j); - } - } - } - - /* Check that uN_strchr() does not read past the end of the string. */ - { - char *page_boundary = (char *) zerosize_ptr (); - size_t n; - - if (page_boundary != NULL) - { - for (n = 2; n <= 500 / sizeof (UNIT); n++) - { - UNIT *mem = (UNIT *) (page_boundary - n * sizeof (UNIT)); - U_SET (mem, 'X', n - 2); - mem[n - 2] = 0; - ASSERT (U_STRCHR (mem, 'U') == NULL); - mem[n - 2] = 'X'; - mem[n - 1] = 0; - ASSERT (U_STRCHR (mem, 'U') == NULL); - } - } - } - -#if 0 - /* This check is disabled, because uN_strchr() is allowed to read past the - first occurrence of the byte being searched. In fact, u8_strchr() does - so, on i586 glibc systems: u8_strchr calls strchr, which in - glibc/sysdeps/i386/i586/strchr.S loads the second word before the - handling of the first word has been completed. */ - /* Check that uN_strchr() does not read past the first occurrence of the - byte being searched. */ - { - char *page_boundary = (char *) zerosize_ptr (); - size_t n; - - if (page_boundary != NULL) - { - for (n = 2; n <= 500 / sizeof (UNIT); n++) - { - UNIT *mem = (UNIT *) (page_boundary - n * sizeof (UNIT)); - U_SET (mem, 'X', n - 1); - mem[n - 1] = 0; - ASSERT (U_STRCHR (mem, 'U') == NULL); - - { - size_t i; - - for (i = 0; i < n; i++) - { - mem[i] = 'U'; - ASSERT (U_STRCHR (mem, 'U') == mem + i); - mem[i] = 'X'; - } - } - } - } - } -#endif - - free (input); -} diff --git a/tests/unistr/test-strcmp.h b/tests/unistr/test-strcmp.h index d5fcbe97..485b6f91 100644 --- a/tests/unistr/test-strcmp.h +++ b/tests/unistr/test-strcmp.h @@ -1,5 +1,5 @@ /* Test of uN_strcmp() and uN_strcoll() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-strcpy.h b/tests/unistr/test-strcpy.h index 50d28e15..f8fe5efd 100644 --- a/tests/unistr/test-strcpy.h +++ b/tests/unistr/test-strcpy.h @@ -1,5 +1,5 @@ /* Test of uN_strcpy() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-strdup.h b/tests/unistr/test-strdup.h index 44246e59..1684b39d 100644 --- a/tests/unistr/test-strdup.h +++ b/tests/unistr/test-strdup.h @@ -1,5 +1,5 @@ /* Test of uN_strdup() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-strncat.h b/tests/unistr/test-strncat.h index fc4494e2..0445b6d9 100644 --- a/tests/unistr/test-strncat.h +++ b/tests/unistr/test-strncat.h @@ -1,5 +1,5 @@ /* Test of uN_strncat() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-strncmp.h b/tests/unistr/test-strncmp.h index 3a28784c..628db94c 100644 --- a/tests/unistr/test-strncmp.h +++ b/tests/unistr/test-strncmp.h @@ -1,5 +1,5 @@ /* Test of uN_strncmp() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-strncpy.h b/tests/unistr/test-strncpy.h index 492e7b8c..6fa0d12e 100644 --- a/tests/unistr/test-strncpy.h +++ b/tests/unistr/test-strncpy.h @@ -1,5 +1,5 @@ /* Test of uN_strncpy() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-strnlen.h b/tests/unistr/test-strnlen.h index 0a5ce8b9..1199126c 100644 --- a/tests/unistr/test-strnlen.h +++ b/tests/unistr/test-strnlen.h @@ -1,5 +1,5 @@ /* Test of uN_strnlen() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u-strstr.h b/tests/unistr/test-u-strstr.h deleted file mode 100644 index 417f8b33..00000000 --- a/tests/unistr/test-u-strstr.h +++ /dev/null @@ -1,210 +0,0 @@ -/* Test of uN_strstr() functions. - Copyright (C) 2004, 2007-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -static void -test_u_strstr (void) -{ - { - const UNIT input[] = { 'f', 'o', 'o', 0 }; - const UNIT needle[] = { 0 }; - const UNIT *result = U_STRSTR (input, needle); - ASSERT (result == input); - } - - { - const UNIT input[] = { 'f', 'o', 'o', 0 }; - const UNIT needle[] = { 'o', 0 }; - const UNIT *result = U_STRSTR (input, needle); - ASSERT (result == input + 1); - } - - { - const UNIT input[] = - { 'A', 'B', 'C', ' ', 'A', 'B', 'C', 'D', 'A', 'B', ' ', 'A', 'B', 'C', - 'D', 'A', 'B', 'C', 'D', 'A', 'B', 'D', 'E', 0 - }; - const UNIT needle[] = { 'A', 'B', 'C', 'D', 'A', 'B', 'D', 0 }; - const UNIT *result = U_STRSTR (input, needle); - ASSERT (result == input + 15); - } - - { - const UNIT input[] = - { 'A', 'B', 'C', ' ', 'A', 'B', 'C', 'D', 'A', 'B', ' ', 'A', 'B', 'C', - 'D', 'A', 'B', 'C', 'D', 'A', 'B', 'D', 'E', 0 - }; - const UNIT needle[] = { 'A', 'B', 'C', 'D', 'A', 'B', 'E', 0 }; - const UNIT *result = U_STRSTR (input, needle); - ASSERT (result == NULL); - } - - { - const UNIT input[] = - { 'A', 'B', 'C', ' ', 'A', 'B', 'C', 'D', 'A', 'B', ' ', 'A', 'B', 'C', - 'D', 'A', 'B', 'C', 'D', 'A', 'B', 'D', 'E', 0 - }; - const UNIT needle[] = { 'A', 'B', 'C', 'D', 'A', 'B', 'C', 'D', 0 }; - const UNIT *result = U_STRSTR (input, needle); - ASSERT (result == input + 11); - } - - /* Check that a long periodic needle does not cause false positives. */ - { - const UNIT input[] = - { 'F', '_', 'B', 'D', '_', 'C', 'E', '_', 'B', 'D', '_', 'E', 'F', - '_', 'B', 'F', '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', - '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', - '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', '_', 'C', '3', - '_', '8', '8', '_', '2', '0', '_', 'E', 'F', '_', 'B', 'F', - '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', - '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', '_', 'C', '3', - '_', 'A', '7', '_', '2', '0', '_', 'E', 'F', '_', 'B', 'F', - '_', 'B', 'D', 0 - }; - const UNIT needle[] = - { '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', '_', 'E', 'F', - '_', 'B', 'F', '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', - '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', - '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', 0 - }; - const UNIT *result = U_STRSTR (input, needle); - ASSERT (result == NULL); - } - { - const UNIT input[] = - { 'F', '_', 'B', 'D', '_', 'C', 'E', '_', 'B', 'D', '_', 'E', 'F', - '_', 'B', 'F', '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', - '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', - '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', '_', 'C', '3', - '_', '8', '8', '_', '2', '0', '_', 'E', 'F', '_', 'B', 'F', - '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', - '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', '_', 'C', '3', - '_', 'A', '7', '_', '2', '0', '_', 'E', 'F', '_', 'B', 'F', - '_', 'B', 'D', '_', 'D', 'A', '_', 'B', '5', '_', 'C', '2', - '_', 'A', '6', '_', '2', '0', '_', 'E', 'F', '_', 'B', 'F', - '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', - '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', '_', 'E', 'F', - '_', 'B', 'F', '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', - '_', 'B', 'D', 0 - }; - const UNIT needle[] = - { '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', '_', 'E', 'F', - '_', 'B', 'F', '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', - '_', 'B', 'D', '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', - '_', 'E', 'F', '_', 'B', 'F', '_', 'B', 'D', 0 - }; - const UNIT *result = U_STRSTR (input, needle); - ASSERT (result == input + 115); - } - - /* Check that a very long haystack is handled quickly if the needle is - short and occurs near the beginning. */ - { - size_t repeat = 10000; - size_t m = 1000000; - const UNIT needle[] = - { 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 0 - }; - UNIT *haystack = (UNIT *) malloc ((m + 1) * sizeof (UNIT)); - if (haystack != NULL) - { - size_t i; - - haystack[0] = 'B'; - for (i = 1; i < m; i++) - haystack[i] = 'A'; - haystack[m] = '\0'; - - for (; repeat > 0; repeat--) - { - ASSERT (U_STRSTR (haystack, needle) == haystack + 1); - } - - free (haystack); - } - } - - /* Check that a very long needle is discarded quickly if the haystack is - short. */ - { - size_t repeat = 10000; - size_t m = 1000000; - const UNIT haystack[] = - { 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', - 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', - 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', - 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', - 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', - 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', - 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 'A', 'B', 0 - }; - UNIT *needle = (UNIT *) malloc ((m + 1) * sizeof (UNIT)); - if (needle != NULL) - { - size_t i; - - for (i = 0; i < m; i++) - needle[i] = 'A'; - needle[m] = '\0'; - - for (; repeat > 0; repeat--) - { - ASSERT (U_STRSTR (haystack, needle) == NULL); - } - - free (needle); - } - } - - /* Check that the asymptotic worst-case complexity is not quadratic. */ - { - size_t m = 1000000; - UNIT *haystack = (UNIT *) malloc ((2 * m + 2) * sizeof (UNIT)); - UNIT *needle = (UNIT *) malloc ((m + 2) * sizeof (UNIT)); - if (haystack != NULL && needle != NULL) - { - size_t i; - const UNIT *result; - - for (i = 0; i < 2 * m; i++) - haystack[i] = 'A'; - haystack[2 * m] = 'B'; - haystack[2 * m + 1] = 0; - - for (i = 0; i < m; i++) - needle[i] = 'A'; - needle[m] = 'B'; - needle[m + 1] = 0; - - result = U_STRSTR (haystack, needle); - ASSERT (result == haystack + m); - } - free (needle); - free (haystack); - } -} diff --git a/tests/unistr/test-u-strtok.h b/tests/unistr/test-u-strtok.h deleted file mode 100644 index 6c124847..00000000 --- a/tests/unistr/test-u-strtok.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Test of uN_strtok() functions. - Copyright (C) 2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -static void -test_u_strtok (void) -{ - { - UNIT input[] = { 'f', 'o', 'o', 0 }; - const UNIT delim[] = { 0 }; - UNIT *state; - const UNIT *result = U_STRTOK (input, delim, &state); - ASSERT (result == input); - } - - { - UNIT input[] = - { 'A', 'B', 'C', ' ', 'A', 'B', 'C', 'D', 'A', 'B', ' ', '\t', - 'A', 'B', 'C', 'D', 'A', 'B', 'C', 'D', 'A', 'B', 'D', 'E', 0 - }; - const UNIT delim[] = { ' ', '\t', 0 }; - UNIT *state; - const UNIT *result; - result = U_STRTOK (input, delim, &state); - ASSERT (result == input); - result = U_STRTOK (NULL, delim, &state); - ASSERT (result == input + 4); - result = U_STRTOK (NULL, delim, &state); - ASSERT (result == input + 12); - result = U_STRTOK (NULL, delim, &state); - ASSERT (result == NULL); - } - - /* Check for multibyte delimiters. */ - { - ucs4_t u_input[] = - { 'A', 'B', 'C', 0x3000, 'A', 'B', 'C', 'D', 'A', 'B', 0x3000, 0x3001, - 'A', 'B', 'C', 'D', 'A', 'B', 'C', 'D', 'A', 'B', 'D', 'E', 0 - }; - ucs4_t u_delim[] = { 0x3000, 0x3001, 0 }; - size_t input_len = 6 * SIZEOF (u_input); - UNIT *input = (UNIT *) malloc (input_len); - size_t delim_len = 6 * SIZEOF (u_delim); - UNIT *delim = (UNIT *) malloc (delim_len); - UNIT *state; - const UNIT *result; - UNIT *ptr, *first_ptr, *second_ptr; - size_t i; - for (i = 0, ptr = input; i < SIZEOF (u_input) && u_input[i] != 0; i++) - { - int ret = U_UCTOMB (ptr, u_input[i], input_len - (ptr - input)); - if (i == 4) - first_ptr = ptr; - if (i == 12) - second_ptr = ptr; - ptr += ret; - } - *ptr = 0; - for (i = 0, ptr = delim; i < SIZEOF (u_delim) && u_delim[i] != 0; i++) - { - int ret = U_UCTOMB (ptr, u_delim[i], delim_len - (ptr - delim)); - ptr += ret; - } - *ptr = 0; - result = U_STRTOK (input, delim, &state); - ASSERT (result == input); - result = U_STRTOK (NULL, delim, &state); - ASSERT (result == first_ptr); - result = U_STRTOK (NULL, delim, &state); - ASSERT (result == second_ptr); - result = U_STRTOK (NULL, delim, &state); - ASSERT (result == NULL); - free (input); - free (delim); - } -} diff --git a/tests/unistr/test-u16-check.c b/tests/unistr/test-u16-check.c index 23adffe4..b7a9c103 100644 --- a/tests/unistr/test-u16-check.c +++ b/tests/unistr/test-u16-check.c @@ -1,5 +1,5 @@ /* Test of u16_check() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-chr.c b/tests/unistr/test-u16-chr.c index 7ffeb57a..d71755c1 100644 --- a/tests/unistr/test-u16-chr.c +++ b/tests/unistr/test-u16-chr.c @@ -1,5 +1,5 @@ /* Test of u16_chr() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,14 +21,11 @@ #include "unistr.h" #include <stdlib.h> -#include <string.h> #include "zerosize-ptr.h" #include "macros.h" #define UNIT uint16_t -#define U_UCTOMB u16_uctomb -#define U32_TO_U u32_to_u16 #define U_CHR u16_chr #define U_SET u16_set #include "test-chr.h" diff --git a/tests/unistr/test-u16-cmp.c b/tests/unistr/test-u16-cmp.c index ab2025bc..1ab9019a 100644 --- a/tests/unistr/test-u16-cmp.c +++ b/tests/unistr/test-u16-cmp.c @@ -1,5 +1,5 @@ /* Test of u16_cmp() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-cmp2.c b/tests/unistr/test-u16-cmp2.c index 1a7ce045..3993dcdd 100644 --- a/tests/unistr/test-u16-cmp2.c +++ b/tests/unistr/test-u16-cmp2.c @@ -1,5 +1,5 @@ /* Test of u16_cmp2() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-cpy-alloc.c b/tests/unistr/test-u16-cpy-alloc.c index a62502f3..d1aa2116 100644 --- a/tests/unistr/test-u16-cpy-alloc.c +++ b/tests/unistr/test-u16-cpy-alloc.c @@ -1,5 +1,5 @@ /* Test of u16_cpy_alloc() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-cpy.c b/tests/unistr/test-u16-cpy.c index b109514e..168a459a 100644 --- a/tests/unistr/test-u16-cpy.c +++ b/tests/unistr/test-u16-cpy.c @@ -1,5 +1,5 @@ /* Test of u16_cpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-mblen.c b/tests/unistr/test-u16-mblen.c index 5cec88d4..13186f3f 100644 --- a/tests/unistr/test-u16-mblen.c +++ b/tests/unistr/test-u16-mblen.c @@ -1,5 +1,5 @@ /* Test of u16_mblen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-mbsnlen.c b/tests/unistr/test-u16-mbsnlen.c index 4e99b570..a2d8b10f 100644 --- a/tests/unistr/test-u16-mbsnlen.c +++ b/tests/unistr/test-u16-mbsnlen.c @@ -1,5 +1,5 @@ /* Test of u16_mbsnlen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-mbtouc-unsafe.c b/tests/unistr/test-u16-mbtouc-unsafe.c index 68110336..a1d12149 100644 --- a/tests/unistr/test-u16-mbtouc-unsafe.c +++ b/tests/unistr/test-u16-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Test of u16_mbtouc_unsafe() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-mbtouc.c b/tests/unistr/test-u16-mbtouc.c index f673ee8c..4545add7 100644 --- a/tests/unistr/test-u16-mbtouc.c +++ b/tests/unistr/test-u16-mbtouc.c @@ -1,5 +1,5 @@ /* Test of u16_mbtouc() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-mbtouc.h b/tests/unistr/test-u16-mbtouc.h index 7019b4a1..ef0fb68a 100644 --- a/tests/unistr/test-u16-mbtouc.h +++ b/tests/unistr/test-u16-mbtouc.h @@ -1,5 +1,5 @@ /* Test of u16_mbtouc() and u16_mbtouc_unsafe() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-mbtoucr.c b/tests/unistr/test-u16-mbtoucr.c index bf93b127..fb1264d9 100644 --- a/tests/unistr/test-u16-mbtoucr.c +++ b/tests/unistr/test-u16-mbtoucr.c @@ -1,5 +1,5 @@ /* Test of u16_mbtoucr() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-move.c b/tests/unistr/test-u16-move.c index 32588d57..ff1e6e35 100644 --- a/tests/unistr/test-u16-move.c +++ b/tests/unistr/test-u16-move.c @@ -1,5 +1,5 @@ /* Test of u16_move() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-next.c b/tests/unistr/test-u16-next.c index f338f768..d9ac6e93 100644 --- a/tests/unistr/test-u16-next.c +++ b/tests/unistr/test-u16-next.c @@ -1,5 +1,5 @@ /* Test of u16_next() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-prev.c b/tests/unistr/test-u16-prev.c index 8dcf6c12..90e83418 100644 --- a/tests/unistr/test-u16-prev.c +++ b/tests/unistr/test-u16-prev.c @@ -1,5 +1,5 @@ /* Test of u16_prev() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-set.c b/tests/unistr/test-u16-set.c index a545f29b..f3e63052 100644 --- a/tests/unistr/test-u16-set.c +++ b/tests/unistr/test-u16-set.c @@ -1,5 +1,5 @@ /* Test of u16_set() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-stpcpy.c b/tests/unistr/test-u16-stpcpy.c index 9615999d..6bf3ecb1 100644 --- a/tests/unistr/test-u16-stpcpy.c +++ b/tests/unistr/test-u16-stpcpy.c @@ -1,5 +1,5 @@ /* Test of u16_stpcpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-stpncpy.c b/tests/unistr/test-u16-stpncpy.c index 5bebcfb1..e53ce6be 100644 --- a/tests/unistr/test-u16-stpncpy.c +++ b/tests/unistr/test-u16-stpncpy.c @@ -1,5 +1,5 @@ /* Test of u16_stpncpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strcat.c b/tests/unistr/test-u16-strcat.c index d381d0cd..9d6032eb 100644 --- a/tests/unistr/test-u16-strcat.c +++ b/tests/unistr/test-u16-strcat.c @@ -1,5 +1,5 @@ /* Test of u16_strcat() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strchr.c b/tests/unistr/test-u16-strchr.c deleted file mode 100644 index d33f7405..00000000 --- a/tests/unistr/test-u16-strchr.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Test of u16_strchr() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini <bonzini@gnu.org>, 2010. */ - -#include <config.h> - -#include "unistr.h" - -#include <stdlib.h> -#include <string.h> - -#include "zerosize-ptr.h" -#include "macros.h" - -#define UNIT uint16_t -#define U_UCTOMB u16_uctomb -#define U32_TO_U u32_to_u16 -#define U_STRCHR u16_strchr -#define U_SET u16_set -#include "test-strchr.h" - -int -main (void) -{ - test_strchr (); - - return 0; -} diff --git a/tests/unistr/test-u16-strcmp.c b/tests/unistr/test-u16-strcmp.c index 9c976139..5fc47774 100644 --- a/tests/unistr/test-u16-strcmp.c +++ b/tests/unistr/test-u16-strcmp.c @@ -1,5 +1,5 @@ /* Test of u16_strcmp() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strcmp.h b/tests/unistr/test-u16-strcmp.h index 6a3d988c..ad54a437 100644 --- a/tests/unistr/test-u16-strcmp.h +++ b/tests/unistr/test-u16-strcmp.h @@ -1,5 +1,5 @@ /* Test of u16_strcmp() and u16_strcoll() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strcoll.c b/tests/unistr/test-u16-strcoll.c index ac32c5bc..e24814a1 100644 --- a/tests/unistr/test-u16-strcoll.c +++ b/tests/unistr/test-u16-strcoll.c @@ -1,5 +1,5 @@ /* Test of u16_strcoll() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strcpy.c b/tests/unistr/test-u16-strcpy.c index e274d784..e017a112 100644 --- a/tests/unistr/test-u16-strcpy.c +++ b/tests/unistr/test-u16-strcpy.c @@ -1,5 +1,5 @@ /* Test of u16_strcpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strdup.c b/tests/unistr/test-u16-strdup.c index 33d1d0b4..f0266d1b 100644 --- a/tests/unistr/test-u16-strdup.c +++ b/tests/unistr/test-u16-strdup.c @@ -1,5 +1,5 @@ /* Test of u16_strdup() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strlen.c b/tests/unistr/test-u16-strlen.c index 40f6af33..7b8690be 100644 --- a/tests/unistr/test-u16-strlen.c +++ b/tests/unistr/test-u16-strlen.c @@ -1,5 +1,5 @@ /* Test of u16_strlen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strmblen.c b/tests/unistr/test-u16-strmblen.c index 36103a20..80371b0a 100644 --- a/tests/unistr/test-u16-strmblen.c +++ b/tests/unistr/test-u16-strmblen.c @@ -1,5 +1,5 @@ /* Test of u16_strmblen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strmbtouc.c b/tests/unistr/test-u16-strmbtouc.c index fb6f08a5..ceeaf2cd 100644 --- a/tests/unistr/test-u16-strmbtouc.c +++ b/tests/unistr/test-u16-strmbtouc.c @@ -1,5 +1,5 @@ /* Test of u16_strmbtouc() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strncat.c b/tests/unistr/test-u16-strncat.c index 9a407f0e..c875cfc8 100644 --- a/tests/unistr/test-u16-strncat.c +++ b/tests/unistr/test-u16-strncat.c @@ -1,5 +1,5 @@ /* Test of u16_strncat() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strncmp.c b/tests/unistr/test-u16-strncmp.c index c6ed7c08..b04431bd 100644 --- a/tests/unistr/test-u16-strncmp.c +++ b/tests/unistr/test-u16-strncmp.c @@ -1,5 +1,5 @@ /* Test of u16_strncmp() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strncpy.c b/tests/unistr/test-u16-strncpy.c index 21e302dc..102f6534 100644 --- a/tests/unistr/test-u16-strncpy.c +++ b/tests/unistr/test-u16-strncpy.c @@ -1,5 +1,5 @@ /* Test of u16_strncpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strnlen.c b/tests/unistr/test-u16-strnlen.c index 85ff647c..beeba64b 100644 --- a/tests/unistr/test-u16-strnlen.c +++ b/tests/unistr/test-u16-strnlen.c @@ -1,5 +1,5 @@ /* Test of u16_strnlen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strstr.c b/tests/unistr/test-u16-strstr.c deleted file mode 100644 index 8f0f4f15..00000000 --- a/tests/unistr/test-u16-strstr.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Test of u16_strstr() function. - Copyright (C) 2011-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Pádraig Brady <P@draigBrady.com>, 2011. */ - -#include <config.h> - -#include "unistr.h" - -#include <stdint.h> -#include <stdlib.h> -#include <signal.h> /* For signal. */ -#include <unistd.h> /* For alarm. */ - -#include "macros.h" - -#define UNIT uint16_t -#define U_STRSTR u16_strstr -#include "test-u-strstr.h" - -int -main (void) -{ -#if HAVE_DECL_ALARM - /* Declare failure if test takes too long, by using default abort - caused by SIGALRM. */ - signal (SIGALRM, SIG_DFL); - alarm (10); -#endif - - test_u_strstr (); - - return 0; -} diff --git a/tests/unistr/test-u16-strtok.c b/tests/unistr/test-u16-strtok.c deleted file mode 100644 index cbd95efa..00000000 --- a/tests/unistr/test-u16-strtok.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Test of u16_strtok() function. - Copyright (C) 2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -#include "unistr.h" - -#include <stdint.h> -#include <stdlib.h> - -#include "macros.h" - -#define UNIT uint16_t -#define U_STRTOK u16_strtok -#define U_UCTOMB u16_uctomb -#include "test-u-strtok.h" - -int -main (void) -{ - test_u_strtok (); - - return 0; -} diff --git a/tests/unistr/test-u16-to-u32.c b/tests/unistr/test-u16-to-u32.c index e0956432..5b382b2f 100644 --- a/tests/unistr/test-u16-to-u32.c +++ b/tests/unistr/test-u16-to-u32.c @@ -1,5 +1,5 @@ /* Test of u16_to_u32() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-to-u8.c b/tests/unistr/test-u16-to-u8.c index f62c21e2..4ef9b9b6 100644 --- a/tests/unistr/test-u16-to-u8.c +++ b/tests/unistr/test-u16-to-u8.c @@ -1,5 +1,5 @@ /* Test of u16_to_u8() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-uctomb.c b/tests/unistr/test-u16-uctomb.c index cfa2104e..ba502254 100644 --- a/tests/unistr/test-u16-uctomb.c +++ b/tests/unistr/test-u16-uctomb.c @@ -1,5 +1,5 @@ /* Test of u16_uctomb() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-check.c b/tests/unistr/test-u32-check.c index 49099ece..fdd64df6 100644 --- a/tests/unistr/test-u32-check.c +++ b/tests/unistr/test-u32-check.c @@ -1,5 +1,5 @@ /* Test of u32_check() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-chr.c b/tests/unistr/test-u32-chr.c index ae274f47..f23aa084 100644 --- a/tests/unistr/test-u32-chr.c +++ b/tests/unistr/test-u32-chr.c @@ -1,5 +1,5 @@ /* Test of u32_chr() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,14 +21,11 @@ #include "unistr.h" #include <stdlib.h> -#include <string.h> #include "zerosize-ptr.h" #include "macros.h" #define UNIT uint32_t -#define U_UCTOMB(s, uc, n) (*(s) = (uc), 1) -#define U32_TO_U(s, n, result, length) (*(length) = (n), (s)) #define U_CHR u32_chr #define U_SET u32_set #include "test-chr.h" diff --git a/tests/unistr/test-u32-cmp.c b/tests/unistr/test-u32-cmp.c index 20c0646a..ab41b31f 100644 --- a/tests/unistr/test-u32-cmp.c +++ b/tests/unistr/test-u32-cmp.c @@ -1,5 +1,5 @@ /* Test of u32_cmp() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-cmp2.c b/tests/unistr/test-u32-cmp2.c index 376aa730..84450b56 100644 --- a/tests/unistr/test-u32-cmp2.c +++ b/tests/unistr/test-u32-cmp2.c @@ -1,5 +1,5 @@ /* Test of u32_cmp2() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-cpy-alloc.c b/tests/unistr/test-u32-cpy-alloc.c index 73a4b859..d3675dd7 100644 --- a/tests/unistr/test-u32-cpy-alloc.c +++ b/tests/unistr/test-u32-cpy-alloc.c @@ -1,5 +1,5 @@ /* Test of u32_cpy_alloc() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-cpy.c b/tests/unistr/test-u32-cpy.c index cf11e6ca..49fc9951 100644 --- a/tests/unistr/test-u32-cpy.c +++ b/tests/unistr/test-u32-cpy.c @@ -1,5 +1,5 @@ /* Test of u32_cpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-mblen.c b/tests/unistr/test-u32-mblen.c index 1e038e14..1ebd93eb 100644 --- a/tests/unistr/test-u32-mblen.c +++ b/tests/unistr/test-u32-mblen.c @@ -1,5 +1,5 @@ /* Test of u32_mblen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-mbsnlen.c b/tests/unistr/test-u32-mbsnlen.c index 9a876346..d9e066ba 100644 --- a/tests/unistr/test-u32-mbsnlen.c +++ b/tests/unistr/test-u32-mbsnlen.c @@ -1,5 +1,5 @@ /* Test of u32_mbsnlen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-mbtouc-unsafe.c b/tests/unistr/test-u32-mbtouc-unsafe.c index d0ee0afb..cb3052cb 100644 --- a/tests/unistr/test-u32-mbtouc-unsafe.c +++ b/tests/unistr/test-u32-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Test of u32_mbtouc_unsafe() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-mbtouc.c b/tests/unistr/test-u32-mbtouc.c index e5829794..7c981b5c 100644 --- a/tests/unistr/test-u32-mbtouc.c +++ b/tests/unistr/test-u32-mbtouc.c @@ -1,5 +1,5 @@ /* Test of u32_mbtouc() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-mbtouc.h b/tests/unistr/test-u32-mbtouc.h index b0a74988..7d701334 100644 --- a/tests/unistr/test-u32-mbtouc.h +++ b/tests/unistr/test-u32-mbtouc.h @@ -1,5 +1,5 @@ /* Test of u32_mbtouc() and u32_mbtouc_unsafe() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-mbtoucr.c b/tests/unistr/test-u32-mbtoucr.c index 898baa27..7b1034c5 100644 --- a/tests/unistr/test-u32-mbtoucr.c +++ b/tests/unistr/test-u32-mbtoucr.c @@ -1,5 +1,5 @@ /* Test of u32_mbtoucr() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-move.c b/tests/unistr/test-u32-move.c index 0dd9e30b..44f95c00 100644 --- a/tests/unistr/test-u32-move.c +++ b/tests/unistr/test-u32-move.c @@ -1,5 +1,5 @@ /* Test of u32_move() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-next.c b/tests/unistr/test-u32-next.c index 339ffb98..a5852e2c 100644 --- a/tests/unistr/test-u32-next.c +++ b/tests/unistr/test-u32-next.c @@ -1,5 +1,5 @@ /* Test of u32_next() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-prev.c b/tests/unistr/test-u32-prev.c index a49525d7..95187afa 100644 --- a/tests/unistr/test-u32-prev.c +++ b/tests/unistr/test-u32-prev.c @@ -1,5 +1,5 @@ /* Test of u32_prev() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-set.c b/tests/unistr/test-u32-set.c index 00516098..120804f1 100644 --- a/tests/unistr/test-u32-set.c +++ b/tests/unistr/test-u32-set.c @@ -1,5 +1,5 @@ /* Test of u32_set() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-stpcpy.c b/tests/unistr/test-u32-stpcpy.c index 04a16a5b..9c99c52a 100644 --- a/tests/unistr/test-u32-stpcpy.c +++ b/tests/unistr/test-u32-stpcpy.c @@ -1,5 +1,5 @@ /* Test of u32_stpcpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-stpncpy.c b/tests/unistr/test-u32-stpncpy.c index 4b996667..e29683bd 100644 --- a/tests/unistr/test-u32-stpncpy.c +++ b/tests/unistr/test-u32-stpncpy.c @@ -1,5 +1,5 @@ /* Test of u32_stpncpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strcat.c b/tests/unistr/test-u32-strcat.c index 02f9615d..66e7c853 100644 --- a/tests/unistr/test-u32-strcat.c +++ b/tests/unistr/test-u32-strcat.c @@ -1,5 +1,5 @@ /* Test of u32_strcat() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strchr.c b/tests/unistr/test-u32-strchr.c deleted file mode 100644 index 054b9963..00000000 --- a/tests/unistr/test-u32-strchr.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Test of u32_strchr() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini <bonzini@gnu.org>, 2010. */ - -#include <config.h> - -#include "unistr.h" - -#include <stdlib.h> -#include <string.h> - -#include "zerosize-ptr.h" -#include "macros.h" - -#define UNIT uint32_t -#define U_UCTOMB(s, uc, n) (*(s) = (uc), 1) -#define U32_TO_U(s, n, result, length) (*(length) = (n), (s)) -#define U_STRCHR u32_strchr -#define U_SET u32_set -#include "test-strchr.h" - -int -main (void) -{ - test_strchr (); - - return 0; -} diff --git a/tests/unistr/test-u32-strcmp.c b/tests/unistr/test-u32-strcmp.c index 8b420cf8..8364a415 100644 --- a/tests/unistr/test-u32-strcmp.c +++ b/tests/unistr/test-u32-strcmp.c @@ -1,5 +1,5 @@ /* Test of u32_strcmp() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strcmp.h b/tests/unistr/test-u32-strcmp.h index 4b1fdd03..6d24132e 100644 --- a/tests/unistr/test-u32-strcmp.h +++ b/tests/unistr/test-u32-strcmp.h @@ -1,5 +1,5 @@ /* Test of u32_strcmp() and u32_strcoll() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strcoll.c b/tests/unistr/test-u32-strcoll.c index f718a82f..36954e73 100644 --- a/tests/unistr/test-u32-strcoll.c +++ b/tests/unistr/test-u32-strcoll.c @@ -1,5 +1,5 @@ /* Test of u32_strcoll() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strcpy.c b/tests/unistr/test-u32-strcpy.c index b388890d..2e22aad4 100644 --- a/tests/unistr/test-u32-strcpy.c +++ b/tests/unistr/test-u32-strcpy.c @@ -1,5 +1,5 @@ /* Test of u32_strcpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strdup.c b/tests/unistr/test-u32-strdup.c index c200e651..ede8e544 100644 --- a/tests/unistr/test-u32-strdup.c +++ b/tests/unistr/test-u32-strdup.c @@ -1,5 +1,5 @@ /* Test of u32_strdup() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strlen.c b/tests/unistr/test-u32-strlen.c index a7973987..a349be75 100644 --- a/tests/unistr/test-u32-strlen.c +++ b/tests/unistr/test-u32-strlen.c @@ -1,5 +1,5 @@ /* Test of u32_strlen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strmblen.c b/tests/unistr/test-u32-strmblen.c index 0b745314..733f8fc8 100644 --- a/tests/unistr/test-u32-strmblen.c +++ b/tests/unistr/test-u32-strmblen.c @@ -1,5 +1,5 @@ /* Test of u32_strmblen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strmbtouc.c b/tests/unistr/test-u32-strmbtouc.c index 39451f79..79c222e0 100644 --- a/tests/unistr/test-u32-strmbtouc.c +++ b/tests/unistr/test-u32-strmbtouc.c @@ -1,5 +1,5 @@ /* Test of u32_strmbtouc() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strncat.c b/tests/unistr/test-u32-strncat.c index 2c78c8f9..346bafb7 100644 --- a/tests/unistr/test-u32-strncat.c +++ b/tests/unistr/test-u32-strncat.c @@ -1,5 +1,5 @@ /* Test of u32_strncat() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strncmp.c b/tests/unistr/test-u32-strncmp.c index f1cad819..d69913da 100644 --- a/tests/unistr/test-u32-strncmp.c +++ b/tests/unistr/test-u32-strncmp.c @@ -1,5 +1,5 @@ /* Test of u32_strncmp() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strncpy.c b/tests/unistr/test-u32-strncpy.c index ebe0addf..9309c0ed 100644 --- a/tests/unistr/test-u32-strncpy.c +++ b/tests/unistr/test-u32-strncpy.c @@ -1,5 +1,5 @@ /* Test of u32_strncpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strnlen.c b/tests/unistr/test-u32-strnlen.c index 7941ab3f..69299148 100644 --- a/tests/unistr/test-u32-strnlen.c +++ b/tests/unistr/test-u32-strnlen.c @@ -1,5 +1,5 @@ /* Test of u32_strnlen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strstr.c b/tests/unistr/test-u32-strstr.c deleted file mode 100644 index c291b3c4..00000000 --- a/tests/unistr/test-u32-strstr.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Test of u32_strstr() function. - Copyright (C) 2011-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Pádraig Brady <P@draigBrady.com>, 2011. */ - -#include <config.h> - -#include "unistr.h" - -#include <stdint.h> -#include <stdlib.h> -#include <signal.h> /* For signal. */ -#include <unistd.h> /* For alarm. */ - -#include "macros.h" - -#define UNIT uint32_t -#define U_STRSTR u32_strstr -#include "test-u-strstr.h" - -int -main (void) -{ -#if HAVE_DECL_ALARM - /* Declare failure if test takes too long, by using default abort - caused by SIGALRM. */ - signal (SIGALRM, SIG_DFL); - alarm (10); -#endif - - test_u_strstr (); - - return 0; -} diff --git a/tests/unistr/test-u32-strtok.c b/tests/unistr/test-u32-strtok.c deleted file mode 100644 index 04cded78..00000000 --- a/tests/unistr/test-u32-strtok.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Test of u32_strtok() function. - Copyright (C) 2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -#include "unistr.h" - -#include <stdint.h> -#include <stdlib.h> - -#include "macros.h" - -#define UNIT uint32_t -#define U_STRTOK u32_strtok -#define U_UCTOMB u32_uctomb -#include "test-u-strtok.h" - -int -main (void) -{ - test_u_strtok (); - - return 0; -} diff --git a/tests/unistr/test-u32-to-u16.c b/tests/unistr/test-u32-to-u16.c index 65e19856..6faf5379 100644 --- a/tests/unistr/test-u32-to-u16.c +++ b/tests/unistr/test-u32-to-u16.c @@ -1,5 +1,5 @@ /* Test of u32_to_u16() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-to-u8.c b/tests/unistr/test-u32-to-u8.c index deb45603..933fba09 100644 --- a/tests/unistr/test-u32-to-u8.c +++ b/tests/unistr/test-u32-to-u8.c @@ -1,5 +1,5 @@ /* Test of u32_to_u8() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-uctomb.c b/tests/unistr/test-u32-uctomb.c index acc4c73f..0a25177b 100644 --- a/tests/unistr/test-u32-uctomb.c +++ b/tests/unistr/test-u32-uctomb.c @@ -1,5 +1,5 @@ /* Test of u32_uctomb() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-check.c b/tests/unistr/test-u8-check.c index fcf678cd..a32d3850 100644 --- a/tests/unistr/test-u8-check.c +++ b/tests/unistr/test-u8-check.c @@ -1,5 +1,5 @@ /* Test of u8_check() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-chr.c b/tests/unistr/test-u8-chr.c index 2d28f9e7..7c4b9990 100644 --- a/tests/unistr/test-u8-chr.c +++ b/tests/unistr/test-u8-chr.c @@ -1,5 +1,5 @@ /* Test of u8_chr() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,14 +21,11 @@ #include "unistr.h" #include <stdlib.h> -#include <string.h> #include "zerosize-ptr.h" #include "macros.h" #define UNIT uint8_t -#define U_UCTOMB u8_uctomb -#define U32_TO_U u32_to_u8 #define U_CHR u8_chr #define U_SET u8_set #include "test-chr.h" diff --git a/tests/unistr/test-u8-cmp.c b/tests/unistr/test-u8-cmp.c index 5606f0ae..73778c71 100644 --- a/tests/unistr/test-u8-cmp.c +++ b/tests/unistr/test-u8-cmp.c @@ -1,5 +1,5 @@ /* Test of u8_cmp() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-cmp2.c b/tests/unistr/test-u8-cmp2.c index 07b52d92..8a7848e8 100644 --- a/tests/unistr/test-u8-cmp2.c +++ b/tests/unistr/test-u8-cmp2.c @@ -1,5 +1,5 @@ /* Test of u8_cmp2() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-cpy-alloc.c b/tests/unistr/test-u8-cpy-alloc.c index ff898138..2d35b8f4 100644 --- a/tests/unistr/test-u8-cpy-alloc.c +++ b/tests/unistr/test-u8-cpy-alloc.c @@ -1,5 +1,5 @@ /* Test of u8_cpy_alloc() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-cpy.c b/tests/unistr/test-u8-cpy.c index 2e2c06f3..8d1152dc 100644 --- a/tests/unistr/test-u8-cpy.c +++ b/tests/unistr/test-u8-cpy.c @@ -1,5 +1,5 @@ /* Test of u8_cpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-mblen.c b/tests/unistr/test-u8-mblen.c index 3e68b665..75e92d68 100644 --- a/tests/unistr/test-u8-mblen.c +++ b/tests/unistr/test-u8-mblen.c @@ -1,5 +1,5 @@ /* Test of u8_mblen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-mbsnlen.c b/tests/unistr/test-u8-mbsnlen.c index e57e3ea8..8e68550c 100644 --- a/tests/unistr/test-u8-mbsnlen.c +++ b/tests/unistr/test-u8-mbsnlen.c @@ -1,5 +1,5 @@ /* Test of u8_mbsnlen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,64 +57,5 @@ main () } } - /* Test behaviour required by ISO 10646-1, sections R.7 and 2.3c, namely, - that a "malformed sequence" is interpreted in the same way as - "a character that is outside the adopted subset". - Reference: - Markus Kuhn: UTF-8 decoder capability and stress test - <http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt> - <http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html> - */ - /* 3.1. Test that each unexpected continuation byte is signalled as a - malformed sequence of its own. */ - { - static const uint8_t input[] = { '"', 0x80, 0xBF, 0x80, 0xBF, '"' }; - ASSERT (u8_mbsnlen (input, 6) == 6); - } - /* 3.2. Lonely start characters. */ - { - ucs4_t c; - uint8_t input[2]; - - for (c = 0xC0; c <= 0xFF; c++) - { - input[0] = c; - input[1] = ' '; - - ASSERT (u8_mbsnlen (input, 2) == 2); - } - } - /* 3.3. Sequences with last continuation byte missing. */ - /* 3.3.1. 2-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xC0, '"' }; - ASSERT (u8_mbsnlen (input, 3) == 3); - } - /* 3.3.6. 2-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xDF, '"' }; - ASSERT (u8_mbsnlen (input, 3) == 3); - } - /* 3.3.2. 3-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xE0, 0x80, '"' }; - ASSERT (u8_mbsnlen (input, 4) == 3); - } - /* 3.3.7. 3-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xEF, 0xBF, '"' }; - ASSERT (u8_mbsnlen (input, 4) == 3); - } - /* 3.3.3. 4-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xF0, 0x80, 0x80, '"' }; - ASSERT (u8_mbsnlen (input, 5) == 3); - } - /* 3.3.8. 4-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xF7, 0xBF, 0xBF, '"' }; - ASSERT (u8_mbsnlen (input, 5) == 3); - } - return 0; } diff --git a/tests/unistr/test-u8-mbtouc-unsafe.c b/tests/unistr/test-u8-mbtouc-unsafe.c index cf9ba19c..b093aa81 100644 --- a/tests/unistr/test-u8-mbtouc-unsafe.c +++ b/tests/unistr/test-u8-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Test of u8_mbtouc_unsafe() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-mbtouc.c b/tests/unistr/test-u8-mbtouc.c index 9e3b9601..f6960a68 100644 --- a/tests/unistr/test-u8-mbtouc.c +++ b/tests/unistr/test-u8-mbtouc.c @@ -1,5 +1,5 @@ /* Test of u8_mbtouc() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,169 +24,10 @@ #include "test-u8-mbtouc.h" -static void -test_safe_function (int (*my_u8_mbtouc) (ucs4_t *, const uint8_t *, size_t)) -{ - ucs4_t uc; - int ret; - - /* Test behaviour required by ISO 10646-1, sections R.7 and 2.3c, namely, - that a "malformed sequence" is interpreted in the same way as - "a character that is outside the adopted subset". - Reference: - Markus Kuhn: UTF-8 decoder capability and stress test - <http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt> - <http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html> - */ - /* 3.1. Test that each unexpected continuation byte is signalled as a - malformed sequence of its own. */ - { - static const uint8_t input[] = { '"', 0x80, 0xBF, 0x80, 0xBF, '"' }; - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input, 6); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 1, 5); - ASSERT (ret == 1); - ASSERT (uc == 0xFFFD); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 2, 4); - ASSERT (ret == 1); - ASSERT (uc == 0xFFFD); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 3, 3); - ASSERT (ret == 1); - ASSERT (uc == 0xFFFD); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 4, 2); - ASSERT (ret == 1); - ASSERT (uc == 0xFFFD); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 5, 1); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - } - /* 3.2. Lonely start characters. */ - { - ucs4_t c; - uint8_t input[2]; - - for (c = 0xC0; c <= 0xFF; c++) - { - input[0] = c; - input[1] = ' '; - - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input, 2); - ASSERT (ret == 1); - ASSERT (uc == 0xFFFD); - } - } - /* 3.3. Sequences with last continuation byte missing. */ - /* 3.3.1. 2-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xC0, '"' }; - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input, 3); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 1, 2); - ASSERT (ret == 1); - ASSERT (uc == 0xFFFD); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 2, 1); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - } - /* 3.3.6. 2-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xDF, '"' }; - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input, 3); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 1, 2); - ASSERT (ret == 1); - ASSERT (uc == 0xFFFD); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 2, 1); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - } - /* 3.3.2. 3-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xE0, 0x80, '"' }; - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input, 4); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 1, 3); - ASSERT (ret == 2); - ASSERT (uc == 0xFFFD); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 3, 1); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - } - /* 3.3.7. 3-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xEF, 0xBF, '"' }; - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input, 4); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 1, 3); - ASSERT (ret == 2); - ASSERT (uc == 0xFFFD); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 3, 1); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - } - /* 3.3.3. 4-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xF0, 0x80, 0x80, '"' }; - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input, 5); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 1, 4); - ASSERT (ret == 3); - ASSERT (uc == 0xFFFD); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 4, 1); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - } - /* 3.3.8. 4-byte sequence with last byte missing. */ - { - static const uint8_t input[] = { '"', 0xF7, 0xBF, 0xBF, '"' }; - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input, 5); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 1, 4); - ASSERT (ret == 3); - ASSERT (uc == 0xFFFD); - uc = 0xBADFACE; - ret = my_u8_mbtouc (&uc, input + 4, 1); - ASSERT (ret == 1); - ASSERT (uc == 0x0022); - } -} - int main () { test_function (u8_mbtouc); - test_safe_function (u8_mbtouc); return 0; } diff --git a/tests/unistr/test-u8-mbtouc.h b/tests/unistr/test-u8-mbtouc.h index 295160d5..bcafb052 100644 --- a/tests/unistr/test-u8-mbtouc.h +++ b/tests/unistr/test-u8-mbtouc.h @@ -1,5 +1,5 @@ /* Test of u8_mbtouc() and u8_mbtouc_unsafe() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -166,14 +166,14 @@ test_function (int (*my_u8_mbtouc) (ucs4_t *, const uint8_t *, size_t)) static const uint8_t input[] = { 0xF3, 0xD0, 0xBF }; uc = 0xBADFACE; ret = my_u8_mbtouc (&uc, input, 3); - ASSERT (ret == 1); + ASSERT (ret == 1 || ret == 3); ASSERT (uc == 0xFFFD); } { static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 }; uc = 0xBADFACE; ret = my_u8_mbtouc (&uc, input, 3); - ASSERT (ret == 2); + ASSERT (ret == 1 || ret == 3); ASSERT (uc == 0xFFFD); } } diff --git a/tests/unistr/test-u8-mbtoucr.c b/tests/unistr/test-u8-mbtoucr.c index 7f02e8b8..88e08d39 100644 --- a/tests/unistr/test-u8-mbtoucr.c +++ b/tests/unistr/test-u8-mbtoucr.c @@ -1,5 +1,5 @@ /* Test of u8_mbtoucr() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-move.c b/tests/unistr/test-u8-move.c index eed72b46..d18d8dd2 100644 --- a/tests/unistr/test-u8-move.c +++ b/tests/unistr/test-u8-move.c @@ -1,5 +1,5 @@ /* Test of u8_move() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-next.c b/tests/unistr/test-u8-next.c index 4c509aa4..c4e06b59 100644 --- a/tests/unistr/test-u8-next.c +++ b/tests/unistr/test-u8-next.c @@ -1,5 +1,5 @@ /* Test of u8_next() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-prev.c b/tests/unistr/test-u8-prev.c index 9e2a9ba6..61f47ef8 100644 --- a/tests/unistr/test-u8-prev.c +++ b/tests/unistr/test-u8-prev.c @@ -1,5 +1,5 @@ /* Test of u8_prev() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-set.c b/tests/unistr/test-u8-set.c index de2f2810..e778fed9 100644 --- a/tests/unistr/test-u8-set.c +++ b/tests/unistr/test-u8-set.c @@ -1,5 +1,5 @@ /* Test of u8_set() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-stpcpy.c b/tests/unistr/test-u8-stpcpy.c index d7403e87..94c04715 100644 --- a/tests/unistr/test-u8-stpcpy.c +++ b/tests/unistr/test-u8-stpcpy.c @@ -1,5 +1,5 @@ /* Test of u8_stpcpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-stpncpy.c b/tests/unistr/test-u8-stpncpy.c index 18f11df5..4809626b 100644 --- a/tests/unistr/test-u8-stpncpy.c +++ b/tests/unistr/test-u8-stpncpy.c @@ -1,5 +1,5 @@ /* Test of u8_stpncpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strcat.c b/tests/unistr/test-u8-strcat.c index 7f4a0959..7fa9e84e 100644 --- a/tests/unistr/test-u8-strcat.c +++ b/tests/unistr/test-u8-strcat.c @@ -1,5 +1,5 @@ /* Test of u8_strcat() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strchr.c b/tests/unistr/test-u8-strchr.c deleted file mode 100644 index ff7abe6c..00000000 --- a/tests/unistr/test-u8-strchr.c +++ /dev/null @@ -1,149 +0,0 @@ -/* Test of u8_strchr() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paolo Bonzini <bonzini@gnu.org>, 2010. */ - -#include <config.h> - -#include "unistr.h" - -#include <stdlib.h> -#include <string.h> - -#include "zerosize-ptr.h" -#include "macros.h" - -#define UNIT uint8_t -#define U_UCTOMB u8_uctomb -#define U32_TO_U u32_to_u8 -#define U_STRCHR u8_strchr -#define U_SET u8_set -#include "test-strchr.h" - -int -main (void) -{ - test_strchr (); - - /* Check that u8_strchr() does not read past the end of the string. */ - { - char *page_boundary = (char *) zerosize_ptr (); - - if (page_boundary != NULL) - { - UNIT *mem; - - mem = (UNIT *) (page_boundary - 1 * sizeof (UNIT)); - mem[0] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - - mem = (UNIT *) (page_boundary - 2 * sizeof (UNIT)); - mem[0] = 0x50; - mem[1] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - - mem = (UNIT *) (page_boundary - 3 * sizeof (UNIT)); - mem[0] = 0x50; - mem[1] = 0x50; - mem[2] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - - mem = (UNIT *) (page_boundary - 3 * sizeof (UNIT)); - mem[0] = 0xC4; mem[1] = 0xA0; /* U+0120 */ - mem[2] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - - mem = (UNIT *) (page_boundary - 3 * sizeof (UNIT)); - mem[0] = 0xC5; mem[1] = 0xA3; /* U+0163 */ - mem[2] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - - mem = (UNIT *) (page_boundary - 4 * sizeof (UNIT)); - mem[0] = 0x50; - mem[1] = 0x50; - mem[2] = 0x50; - mem[3] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - - mem = (UNIT *) (page_boundary - 4 * sizeof (UNIT)); - mem[0] = 0x50; - mem[1] = 0xC5; mem[2] = 0xA3; /* U+0163 */ - mem[3] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - ASSERT (u8_strchr (mem, 0x163) == mem + 1); - - mem = (UNIT *) (page_boundary - 4 * sizeof (UNIT)); - mem[0] = 0xE3; mem[1] = 0x91; mem[2] = 0x00; /* U+3450 */ - mem[3] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - - mem = (UNIT *) (page_boundary - 4 * sizeof (UNIT)); - mem[0] = 0xE3; mem[1] = 0x92; mem[2] = 0x96; /* U+3496 */ - mem[3] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - - mem = (UNIT *) (page_boundary - 5 * sizeof (UNIT)); - mem[0] = 0x50; - mem[1] = 0x50; - mem[2] = 0x50; - mem[3] = 0x50; - mem[4] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - - mem = (UNIT *) (page_boundary - 5 * sizeof (UNIT)); - mem[0] = 0x50; - mem[1] = 0xE3; mem[2] = 0x92; mem[3] = 0x96; /* U+3496 */ - mem[4] = 0; - ASSERT (u8_strchr (mem, 0x55) == NULL); - ASSERT (u8_strchr (mem, 0x123) == NULL); - ASSERT (u8_strchr (mem, 0x3456) == NULL); - ASSERT (u8_strchr (mem, 0x23456) == NULL); - ASSERT (u8_strchr (mem, 0x3496) == mem + 1); - } - } - - return 0; -} diff --git a/tests/unistr/test-u8-strcmp.c b/tests/unistr/test-u8-strcmp.c index 51a90db3..313cd110 100644 --- a/tests/unistr/test-u8-strcmp.c +++ b/tests/unistr/test-u8-strcmp.c @@ -1,5 +1,5 @@ /* Test of u8_strcmp() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strcmp.h b/tests/unistr/test-u8-strcmp.h index 66dec745..9c25dac4 100644 --- a/tests/unistr/test-u8-strcmp.h +++ b/tests/unistr/test-u8-strcmp.h @@ -1,5 +1,5 @@ /* Test of u8_strcmp() and u8_strcoll() functions. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strcoll.c b/tests/unistr/test-u8-strcoll.c index 73f42ddc..ae5c9a4e 100644 --- a/tests/unistr/test-u8-strcoll.c +++ b/tests/unistr/test-u8-strcoll.c @@ -1,5 +1,5 @@ /* Test of u8_strcoll() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strcpy.c b/tests/unistr/test-u8-strcpy.c index 2dd02013..810f9750 100644 --- a/tests/unistr/test-u8-strcpy.c +++ b/tests/unistr/test-u8-strcpy.c @@ -1,5 +1,5 @@ /* Test of u8_strcpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strdup.c b/tests/unistr/test-u8-strdup.c index c72b3d28..6da21515 100644 --- a/tests/unistr/test-u8-strdup.c +++ b/tests/unistr/test-u8-strdup.c @@ -1,5 +1,5 @@ /* Test of u8_strdup() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strlen.c b/tests/unistr/test-u8-strlen.c index d4b32243..3dfa1b01 100644 --- a/tests/unistr/test-u8-strlen.c +++ b/tests/unistr/test-u8-strlen.c @@ -1,5 +1,5 @@ /* Test of u8_strlen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strmblen.c b/tests/unistr/test-u8-strmblen.c index 46bee920..bde3000e 100644 --- a/tests/unistr/test-u8-strmblen.c +++ b/tests/unistr/test-u8-strmblen.c @@ -1,5 +1,5 @@ /* Test of u8_strmblen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strmbtouc.c b/tests/unistr/test-u8-strmbtouc.c index 1239f40b..55913575 100644 --- a/tests/unistr/test-u8-strmbtouc.c +++ b/tests/unistr/test-u8-strmbtouc.c @@ -1,5 +1,5 @@ /* Test of u8_strmbtouc() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strncat.c b/tests/unistr/test-u8-strncat.c index b7d248b3..bb90041f 100644 --- a/tests/unistr/test-u8-strncat.c +++ b/tests/unistr/test-u8-strncat.c @@ -1,5 +1,5 @@ /* Test of u8_strncat() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strncmp.c b/tests/unistr/test-u8-strncmp.c index 5bd7b5e5..f63cdaa2 100644 --- a/tests/unistr/test-u8-strncmp.c +++ b/tests/unistr/test-u8-strncmp.c @@ -1,5 +1,5 @@ /* Test of u8_strncmp() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strncpy.c b/tests/unistr/test-u8-strncpy.c index 5e20beb9..64cabdc4 100644 --- a/tests/unistr/test-u8-strncpy.c +++ b/tests/unistr/test-u8-strncpy.c @@ -1,5 +1,5 @@ /* Test of u8_strncpy() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strnlen.c b/tests/unistr/test-u8-strnlen.c index c59d7b18..98de7977 100644 --- a/tests/unistr/test-u8-strnlen.c +++ b/tests/unistr/test-u8-strnlen.c @@ -1,5 +1,5 @@ /* Test of u8_strnlen() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strstr.c b/tests/unistr/test-u8-strstr.c deleted file mode 100644 index 3d7be9c3..00000000 --- a/tests/unistr/test-u8-strstr.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Test of u8_strstr() function. - Copyright (C) 2011-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Pádraig Brady <P@draigBrady.com>, 2011. */ - -#include <config.h> - -#include "unistr.h" - -#include <stdint.h> -#include <stdlib.h> -#include <signal.h> /* For signal. */ -#include <unistd.h> /* For alarm. */ - -#include "macros.h" - -#define UNIT uint8_t -#define U_STRSTR u8_strstr -#include "test-u-strstr.h" - -int -main (void) -{ -#if HAVE_DECL_ALARM - /* Declare failure if test takes too long, by using default abort - caused by SIGALRM. Note since we defer to strstr() in this - case, we're assuming that we're running this test on the - same system that we did the check to ensure it has linear - performance characteristics. */ - signal (SIGALRM, SIG_DFL); - alarm (5); -#endif - - test_u_strstr (); - - return 0; -} diff --git a/tests/unistr/test-u8-strtok.c b/tests/unistr/test-u8-strtok.c deleted file mode 100644 index 6745ea8a..00000000 --- a/tests/unistr/test-u8-strtok.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Test of u8_strtok() function. - Copyright (C) 2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> - -#include "unistr.h" - -#include <stdint.h> -#include <stdlib.h> - -#include "macros.h" - -#define UNIT uint8_t -#define U_STRTOK u8_strtok -#define U_UCTOMB u8_uctomb -#include "test-u-strtok.h" - -int -main (void) -{ - test_u_strtok (); - - return 0; -} diff --git a/tests/unistr/test-u8-to-u16.c b/tests/unistr/test-u8-to-u16.c index 5f3ddadd..02ef44fe 100644 --- a/tests/unistr/test-u8-to-u16.c +++ b/tests/unistr/test-u8-to-u16.c @@ -1,5 +1,5 @@ /* Test of u8_to_u16() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-to-u32.c b/tests/unistr/test-u8-to-u32.c index 26ff0029..d148e62a 100644 --- a/tests/unistr/test-u8-to-u32.c +++ b/tests/unistr/test-u8-to-u32.c @@ -1,5 +1,5 @@ /* Test of u8_to_u32() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-uctomb.c b/tests/unistr/test-u8-uctomb.c index f586f04d..8fbdc429 100644 --- a/tests/unistr/test-u8-uctomb.c +++ b/tests/unistr/test-u8-uctomb.c @@ -1,5 +1,5 @@ /* Test of u8_uctomb() function. - Copyright (C) 2010-2015 Free Software Foundation, Inc. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |