dat_strxfrm.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
  3. *
  4. * FILE: dat_strxfrm.c
  5. *
  6. * STRXFRM: size_t strxfrm (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 strcoll().
  15. * If you got errors, check both test results.
  16. *
  17. * The buffer size should be enough to contain a string including a
  18. * null char. Returns the number of bytes of the string (NOT
  19. * including a null char).
  20. */
  21. TST_STRXFRM tst_strxfrm_loc [] = {
  22. {
  23. { Tstrxfrm, TST_LOC_de },
  24. {
  25. { /*inp*/ { "\xf6\xc4\xe4\xfc", "\xf6\xc4\xe4\xfc", 17, 17 }, /* #01 */
  26. /*exp*/ { 0,0,0, },
  27. },
  28. { /*inp*/ { "aA", "Aa", 10, 10 }, /* #02 */
  29. /*exp*/ { 0,0,0 , },
  30. },
  31. { /*inp*/ { "Aa", "aA", 10, 10 }, /* #03 */
  32. /*exp*/ { 0,0,0, },
  33. },
  34. { /*inp*/ { "abc", "", 13, 13 }, /* #04 */
  35. /*exp*/ { 0,0,0, },
  36. },
  37. { /*inp*/ { "a", "B", 7, 7 }, /* #05 */
  38. /*exp*/ { 0,0,0, },
  39. },
  40. { /*inp*/ { "B", "a", 7, 7 }, /* #06 */
  41. /*exp*/ { 0,0,0, },
  42. },
  43. {
  44. /* hiragana == latin1 */
  45. /*inp*/ { "abc", "\244\241\244\242", 13, 9 }, /* #07 */
  46. /*exp*/ { 0,0,0, },
  47. },
  48. { .is_last = 1 }
  49. }
  50. },
  51. {
  52. { Tstrxfrm, TST_LOC_enUS },
  53. {
  54. { /*inp*/ { "abcd", "abcd", 17, 17 }, /* #01 */
  55. /*exp*/ { 0,0,0, },
  56. },
  57. { /*inp*/ { "aA", "Aa", 10, 10 }, /* #02 */
  58. /*exp*/ { 0,0,0 , },
  59. },
  60. { /*inp*/ { "Aa", "aA", 10, 10 }, /* #03 */
  61. /*exp*/ { 0,0,0, },
  62. },
  63. { /*inp*/ { "abc", "", 13, 13 }, /* #04 */
  64. /*exp*/ { 0,0,0, },
  65. },
  66. { /*inp*/ { "a", "B", 7, 7 }, /* #05 */
  67. /*exp*/ { 0,0,0, },
  68. },
  69. { /*inp*/ { "B", "a", 7, 7 }, /* #06 */
  70. /*exp*/ { 0,0,0, },
  71. },
  72. #ifdef NO_WAIVER
  73. {
  74. /* <WAIVER> */
  75. /*inp*/ { "abc", "\244\241\244\242", 13, 9 }, /* #07 */
  76. /*exp*/ { EINVAL,0,0, },
  77. },
  78. #endif
  79. { .is_last = 1 }
  80. }
  81. },
  82. #if 0
  83. {
  84. { Tstrxfrm, TST_LOC_eucJP }, /* ??? */
  85. {
  86. {
  87. /* #01 */
  88. /*inp*/ { "\244\242\244\241", "\244\241\244\242", 5, 5 },
  89. /*exp*/ { 0,0,0, },
  90. },
  91. {
  92. /* #02 */
  93. /*inp*/ { "\244\241\244\242", "\244\242\244\241", 5, 5 },
  94. /*exp*/ { 0,0,0, },
  95. },
  96. {
  97. /* #03 */
  98. /*inp*/ { "\244\242\216\261", "\216\261\244\242", 5, 5 },
  99. /*exp*/ { 0,0,0, },
  100. },
  101. #ifdef NO_WAIVER
  102. {
  103. /*inp*/ { "AAA", "\216\217", 5, 5 }, /* #04 */ /* <WAIVER> */
  104. /*exp*/ { EINVAL,0,0, },
  105. },
  106. #endif
  107. { .is_last = 1 }
  108. }
  109. },
  110. #else
  111. {
  112. { Tstrxfrm, TST_LOC_ja_UTF8 }, /* ??? */
  113. {
  114. {
  115. /* #01 */
  116. /*inp*/ { "\343\201\202\343\201\201", "\343\201\201\343\201\202", 7, 7 },
  117. /*exp*/ { 0,0,0, },
  118. },
  119. {
  120. /* #02 */
  121. /*inp*/ { "\343\201\201\343\201\202", "\343\201\202\343\201\201", 7, 7 },
  122. /*exp*/ { 0,0,0, },
  123. },
  124. {
  125. /* #03 */
  126. /*inp*/ { "\343\201\202\357\275\261", "\357\275\261343\201\202", 7, 7 },
  127. /*exp*/ { 0,0,0, },
  128. },
  129. #ifdef NO_WAIVER
  130. {
  131. /*inp*/ { "AAA", "\340\277\220", 5, 5 }, /* #04 */ /* <WAIVER> */
  132. /*exp*/ { EINVAL,0,0, },
  133. },
  134. #endif
  135. { .is_last = 1 }
  136. }
  137. },
  138. #endif
  139. {
  140. { Tstrxfrm, TST_LOC_end }
  141. }
  142. };