dat_towctrans.c 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
  3. *
  4. * FILE: dat_towctrans.c
  5. *
  6. * TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t charclass);
  7. */
  8. #include <errno.h>
  9. #include <stdlib.h>
  10. #include <wctype.h>
  11. #include "tst_types.h"
  12. #include "tgn_locdef.h"
  13. /*
  14. * NOTE:
  15. * Set ret_flg = 1, when a return value is expected to be 0 (FALSE).
  16. * Set ret_flg = 0, when a return value is expected to be non-zero (TRUE).
  17. *
  18. * Since the functions return *non*-zero value for TRUE, can't
  19. * compare an actual return value with an expected return value.
  20. * Set the ret_flg=0 for TRUE cases and the tst_isw*() will check
  21. * the non-zero value.
  22. *
  23. * { { WEOF }, { 0,0,1,0 } },
  24. * | |
  25. * | ret_val: an expected return value
  26. * ret_flg: if 1, compare an actual return value with the
  27. * ret_val; if 0, the test program checks
  28. * the actual return value.
  29. *
  30. * CAUTION: if a charclass is invalid, the test function gives
  31. * towctrans() an invalid wctrans object instead of a return value
  32. * from wctrans() which is supposed to be 0.
  33. */
  34. TST_TOWCTRANS tst_towctrans_loc [] = {
  35. {
  36. { Ttowctrans, TST_LOC_C },
  37. {
  38. #ifdef SHOJI_IS_RIGHT
  39. { { 0x0010, "xxxxxxx" }, { EINVAL,1,0x0010 } },
  40. #else
  41. { { 0x0010, "xxxxxxx" }, { 0, 1,0x0010 } },
  42. #endif
  43. { { 0x007F, "tolower" }, { 0, 1,0x007F } },
  44. { { 0x0061, "toupper" }, { 0, 1,0x0041 } },
  45. { { 0x0041, "tolower" }, { 0, 1,0x0061 } },
  46. { .is_last = 1 }
  47. }
  48. },
  49. {
  50. { Ttowctrans, TST_LOC_de },
  51. {
  52. #ifdef SHOJI_IS_RIGHT
  53. { { 0x0010, "tojkata" }, { EINVAL,1,0x0010 } },
  54. #else
  55. { { 0x0010, "tojkata" }, { 0, 1,0x0010 } },
  56. #endif
  57. { { 0x0080, "tolower" }, { 0, 1,0x0080 } },
  58. { { 0x00EC, "toupper" }, { 0, 1,0x00CC } },
  59. { { 0x00CC, "tolower" }, { 0, 1,0x00EC } },
  60. { .is_last = 1 }
  61. }
  62. },
  63. {
  64. { Ttowctrans, TST_LOC_enUS },
  65. {
  66. #ifdef SHOJI_IS_RIGHT
  67. { { 0x0010, "xxxxxxx" }, { EINVAL,1,0x0010 } },
  68. #else
  69. { { 0x0010, "xxxxxxx" }, { 0, 1,0x0010 } },
  70. #endif
  71. { { 0x007F, "tolower" }, { 0, 1,0x007F } },
  72. { { 0x0061, "toupper" }, { 0, 1,0x0041 } },
  73. { { 0x0041, "tolower" }, { 0, 1,0x0061 } },
  74. { .is_last = 1 }
  75. }
  76. },
  77. {
  78. #if 0
  79. { Ttowctrans, TST_LOC_eucJP },
  80. #else
  81. { Ttowctrans, TST_LOC_ja_UTF8 },
  82. #endif
  83. {
  84. { { 0xFF21, "tolower" }, { 0, 1,0xFF41 } },
  85. { { 0xFF41, "toupper" }, { 0, 1,0xFF21 } },
  86. { { 0x30A1, "tojhira" }, { 0, 1,0x3041 } },
  87. { { 0x3041, "tojkata" }, { 0, 1,0x30A1 } },
  88. { .is_last = 1 }
  89. }
  90. },
  91. {
  92. { Ttowctrans, TST_LOC_end }
  93. }
  94. };