dat_mbstowcs.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /*
  2. * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
  3. *
  4. * FILE: dat_mbstowcs.c
  5. *
  6. * MBSTOWCS: size_t mbstowcs (wchar_t *ws, char *s, size_t n);
  7. */
  8. #include <limits.h>
  9. TST_MBSTOWCS tst_mbstowcs_loc [] = {
  10. {
  11. { Tmbstowcs, TST_LOC_de },
  12. {
  13. { /*----------------- #01 -----------------*/
  14. {
  15. {
  16. { 1, 1, "ABC", 4 },
  17. { 1, 1, "ABC", 3 },
  18. { 1, 1, "ABC", 2 },
  19. }
  20. },
  21. {
  22. {
  23. { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
  24. { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
  25. { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 } },
  26. }
  27. }
  28. },
  29. { /*----------------- #02 -----------------*/
  30. {
  31. {
  32. { 1, 1, "ABC", 4 },
  33. { 1, 1, "", 1 },
  34. { 0, 1, "ABC", 4 },
  35. }
  36. },
  37. {
  38. {
  39. { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
  40. { 0,1,0, { 0x0000 } },
  41. { 0,1,3, { 0x0000 } },
  42. }
  43. }
  44. },
  45. { .is_last = 1 }
  46. }
  47. },
  48. {
  49. { Tmbstowcs, TST_LOC_enUS },
  50. {
  51. { /*----------------- #01 -----------------*/
  52. {
  53. {
  54. { 1, 1, "ABC", 4 },
  55. { 1, 1, "ABC", 3 },
  56. { 1, 1, "ABC", 2 },
  57. }
  58. },
  59. {
  60. {
  61. { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
  62. { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
  63. { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 } },
  64. }
  65. }
  66. },
  67. { /*----------------- #02 -----------------*/
  68. {
  69. {
  70. { 1, 1, "ABC", 4 },
  71. { 1, 1, "", 1 },
  72. { 0, 1, "ABC", 4 },
  73. }
  74. },
  75. {
  76. {
  77. { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } },
  78. { 0,1,0, { 0x0000 } },
  79. { 0,1,3, { 0x0000 } },
  80. }
  81. }
  82. },
  83. { .is_last = 1 }
  84. }
  85. },
  86. #if 0
  87. {
  88. { Tmbstowcs, TST_LOC_eucJP },
  89. {
  90. { /*----------------- #01 -----------------*/
  91. {
  92. {
  93. { 1, 1, "\244\242\244\244\244\246ABC", 7 },
  94. { 1, 1, "\244\242\244\244\244\246ABC", 6 },
  95. { 1, 1, "\244\242\244\244\244\246ABC", 4 },
  96. }
  97. },
  98. {
  99. {
  100. { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
  101. { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
  102. { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } },
  103. }
  104. }
  105. },
  106. { /*----------------- #02 -----------------*/
  107. {
  108. {
  109. #ifdef SHOJI_IS_RIGHT
  110. /* XXX I really don't understand the first and third line.
  111. the result of the first line is the same as the first
  112. in the last test (i.e., returns 6). Also, the third
  113. test will simply convert everything. */
  114. { 1, 1, "\244\242\244\244\244\246ABC", 7 },
  115. { 1, 1, "", 1 },
  116. { 0, 1, "\244\242\244\244\244\246ABC", 7 },
  117. #else
  118. { 1, 1, "\244\242\244\244\244\246ABC", 4 },
  119. { 1, 1, "", 1 },
  120. { 0, 1, "\244\242\244\244\244\246ABC", 0 },
  121. #endif
  122. }
  123. },
  124. {
  125. {
  126. { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } },
  127. { 0,1,0, { 0x0000 } },
  128. { 0,1,6, { 0x0000 } },
  129. }
  130. }
  131. },
  132. { .is_last = 1 }
  133. }
  134. },
  135. #else
  136. {
  137. { Tmbstowcs, TST_LOC_ja_UTF8 },
  138. {
  139. { /*----------------- #01 -----------------*/
  140. {
  141. {
  142. { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 7 },
  143. { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 6 },
  144. { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 4 },
  145. }
  146. },
  147. {
  148. {
  149. { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
  150. { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }},
  151. { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } },
  152. }
  153. }
  154. },
  155. { /*----------------- #02 -----------------*/
  156. {
  157. {
  158. #ifdef SHOJI_IS_RIGHT
  159. /* XXX I really don't understand the first and third line.
  160. the result of the first line is the same as the first
  161. in the last test (i.e., returns 6). Also, the third
  162. test will simply convert everything. */
  163. { 1, 1, "\244\242\244\244\244\246ABC", 7 },
  164. { 1, 1, "", 1 },
  165. { 0, 1, "\244\242\244\244\244\246ABC", 7 },
  166. #else
  167. { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 4 },
  168. { 1, 1, "", 1 },
  169. { 0, 1, "\343\201\202\343\201\204\343\201\206ABC", 7 },
  170. #endif
  171. }
  172. },
  173. {
  174. {
  175. { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } },
  176. { 0,1,0, { 0x0000 } },
  177. { 0,1,6, { 0x0000 } },
  178. }
  179. }
  180. },
  181. { .is_last = 1 }
  182. }
  183. },
  184. #endif
  185. {
  186. { Tmbstowcs, TST_LOC_end }
  187. }
  188. };