tst-translit.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Test of translitation in the gettext functions.
  2. Copyright (C) 2000-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <http://www.gnu.org/licenses/>. */
  16. #include <libintl.h>
  17. #include <locale.h>
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include <unistd.h>
  22. static int
  23. do_test (void)
  24. {
  25. int result = 0;
  26. const char *s;
  27. setenv ("LANGUAGE", "existing-locale", 1);
  28. unsetenv ("OUTPUT_CHARSET");
  29. setlocale (LC_ALL, "en_US.ANSI_X3.4-1968");
  30. textdomain ("translit");
  31. bindtextdomain ("translit", OBJPFX "domaindir");
  32. #define TEST(in, exp) \
  33. s = gettext (in); \
  34. puts (s); \
  35. result |= strcmp (s, exp) != 0;
  36. TEST ("test", "<<(C) AEss>>");
  37. TEST ("test", "<<(C) AEss>>");
  38. TEST ("onemore", " 1/2 * 1/2 = 1/4 ");
  39. TEST ("onemore", " 1/2 * 1/2 = 1/4 ");
  40. TEST ("test", "<<(C) AEss>>");
  41. return result;
  42. }
  43. #define TEST_FUNCTION do_test ()
  44. #include "../test-skeleton.c"