dat_wcsxfrm.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
  3. *
  4. * FILE: dat_wcsxfrm.c
  5. *
  6. * WCSXFRM: size_t wcsxfrm (char *s1, const char s2, size_t n);
  7. */
  8. /*
  9. * NOTE:
  10. *
  11. * Return value and errno value are checked only for 2nd string:
  12. * org2[]; n1 and n2 don't mean bytes to be translated.
  13. * It means a buffer size including a null character.
  14. * Results of this test depens on results of wcscoll().
  15. * If you got errors, check both test results.
  16. */
  17. TST_WCSXFRM tst_wcsxfrm_loc [] = {
  18. {
  19. { Twcsxfrm, TST_LOC_de },
  20. {
  21. { /*inp*/ { { 0x00C1,0x0000 }, { 0x00C1,0x0000 }, 7, 7 }, /* #01 */
  22. /*exp*/ { 0, 0,0, },
  23. },
  24. { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 }, /* #02 */
  25. /*exp*/ { 0, 0,0, },
  26. },
  27. { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 }, /* #03 */
  28. /*exp*/ { 0, 0,0, },
  29. },
  30. { /*inp*/ { { 0x00E4,0x0000 }, { 0x00DC,0x0000 }, 7, 7 }, /* #04 */
  31. /*exp*/ { 0, 0,0, },
  32. },
  33. { /*inp*/ { { 0x00DC,0x0000 }, { 0x00E4,0x0000 }, 7, 7 }, /* #05 */
  34. /*exp*/ { 0, 0,0, },
  35. },
  36. { .is_last = 1 }
  37. }
  38. },
  39. {
  40. { Twcsxfrm, TST_LOC_enUS },
  41. {
  42. { /*inp*/ { { 0x0041,0x0000 }, { 0x0041,0x0000 }, 7, 7 }, /* #01 */
  43. /*exp*/ { 0, 0,0, },
  44. },
  45. { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 }, /* #02 */
  46. /*exp*/ { 0, 0,0, },
  47. },
  48. { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 }, /* #03 */
  49. /*exp*/ { 0, 0,0, },
  50. },
  51. { /*inp*/ { { 0x0000,0x0000 }, { 0x0000,0x0000 }, 7, 7 }, /* #04 */
  52. /*exp*/ { 0, 0,0, },
  53. },
  54. #ifdef NO_WAIVER
  55. { /* <WAIVER> x 2 */
  56. /*inp*/ { { 0x3061,0x0000 }, { 0xFF42,0x0000 }, 7, 7 }, /* #05 */
  57. /* <WAIVER> */
  58. /*exp*/ { EINVAL, 1,(size_t)-1, },
  59. },
  60. #endif
  61. { .is_last = 1 }
  62. }
  63. },
  64. {
  65. #if 0
  66. { Twcsxfrm, TST_LOC_eucJP }, /* need more test data ! */
  67. #else
  68. { Twcsxfrm, TST_LOC_ja_UTF8 }, /* need more test data ! */
  69. #endif
  70. {
  71. { /*inp*/ { { 0x3041,0x0000 }, { 0x3041,0x0000 }, 7, 7 }, /* #01 */
  72. /*exp*/ { 0, 0,0, },
  73. },
  74. { /*inp*/ { { 0x0042,0x0000 }, { 0x0061,0x0000 }, 7, 7 }, /* #02 */
  75. /*exp*/ { 0, 0,0, },
  76. },
  77. { /*inp*/ { { 0x0061,0x0000 }, { 0x0042,0x0000 }, 7, 7 }, /* #03 */
  78. /*exp*/ { 0, 0,0, },
  79. },
  80. { /*inp*/ { { 0x30A2,0x0000 }, { 0xFF71,0x0000 }, 7, 7 }, /* #04 */
  81. /*exp*/ { 0, 0,0, },
  82. },
  83. { /*inp*/ { { 0xFF71,0x0000 }, { 0x30A2,0x0000 }, 7, 7 }, /* #05 */
  84. /*exp*/ { 0, 0,0, },
  85. },
  86. #ifdef NO_WAIVER
  87. /* <WAIVER> x 2 */
  88. { /*inp*/ { { 0x008E,0x0000 }, { 0x008F,0x0000 }, 7, 7 }, /* #06 */
  89. /*exp*/ { EINVAL, 1,(size_t)-1, },
  90. },
  91. #endif
  92. { .is_last = 1 }
  93. }
  94. },
  95. {
  96. { Twcsxfrm, TST_LOC_end }
  97. }
  98. };