dat_mbrlen.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /*
  2. * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
  3. *
  4. * FILE: dat_mbrlen.c
  5. *
  6. * MBRLEN: size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
  7. */
  8. /*
  9. * NOTE:
  10. * (1) A mbstate object is initialized for
  11. * every new data record by the test program.
  12. *
  13. * (2) USE_MBCURMAX is defined as a value of 99.
  14. *
  15. */
  16. TST_MBRLEN tst_mbrlen_loc [] = {
  17. {
  18. { Tmbrlen, TST_LOC_de },
  19. {
  20. { /*----------------- #01 -----------------*/
  21. {
  22. {
  23. { 1, "", 0, 0, 0 },
  24. { 1, "", 1, 0, 0 },
  25. { 1, "\300", USE_MBCURMAX, 0, 0 },
  26. }
  27. },
  28. {
  29. {
  30. { 0, 1, 0, },
  31. { 0, 1, 0, },
  32. { 0, 1, 1, },
  33. }
  34. }
  35. },
  36. { /*----------------- #02 -----------------*/
  37. {
  38. {
  39. { 1, "\300\001", 0, 0, 0 },
  40. { 1, "\300\001", 1, 0, 0 },
  41. { 1, "\317\001", USE_MBCURMAX, 0, 0 },
  42. }
  43. },
  44. {
  45. {
  46. { 0, 1, 0, },
  47. { 0, 1, 1, },
  48. { 0, 1, 1, },
  49. }
  50. }
  51. },
  52. { .is_last = 1 }
  53. }
  54. },
  55. {
  56. { Tmbrlen, TST_LOC_enUS },
  57. {
  58. { /*----------------- #01 -----------------*/
  59. {
  60. {
  61. { 1, "A", 0, 0, 0 },
  62. { 1, "A", 1, 0, 0 },
  63. { 1, "A", USE_MBCURMAX, 0, 0 },
  64. }
  65. },
  66. {
  67. {
  68. { 0, 1, 0, },
  69. { 0, 1, 1, },
  70. { 0, 1, 1, },
  71. }
  72. }
  73. },
  74. { /*----------------- #02 -----------------*/
  75. {
  76. {
  77. { 1, "\317\001", 0, 1, 0 },
  78. { 1, "\317\001", 1, 1, 0 },
  79. { 1, "\317\001", USE_MBCURMAX, 1, 0 },
  80. }
  81. },
  82. {
  83. {
  84. { 0, 1, 0, },
  85. { EILSEQ, 1, -1, },
  86. { EILSEQ, 1, -1, },
  87. }
  88. }
  89. },
  90. { .is_last = 1 }
  91. }
  92. },
  93. #if 0
  94. {
  95. { Tmbrlen, TST_LOC_eucJP },
  96. {
  97. { /*----------------- #01 -----------------*/
  98. {
  99. {
  100. { 1, "\317\302", 1, 1, 1 },
  101. { 0, "", 0, 1, 0 },
  102. { 1, "\317\302", USE_MBCURMAX, 1, 1 },
  103. }
  104. },
  105. {
  106. {
  107. { 0, 1, -2, },
  108. { 0, 1, -1, },
  109. { 0, 1, 2, },
  110. }
  111. }
  112. },
  113. { /*----------------- #02 -----------------*/
  114. {
  115. {
  116. { 1, "\317", 1, 1, 0 },
  117. { 1, "\302", 1, 1, 0 },
  118. { 1, "\317\302", USE_MBCURMAX, 0, 0 },
  119. }
  120. },
  121. {
  122. {
  123. { 0, 1, -2, },
  124. #ifdef SHOJI_IS_RIGHT
  125. { 0, 1, +2, },
  126. #else
  127. /* XXX ISO C explicitly says that the return value does not
  128. XXX reflect the bytes contained in the state. */
  129. { 0, 1, +1, },
  130. #endif
  131. { 0, 1, 2, },
  132. }
  133. }
  134. },
  135. { /*----------------- #03 -----------------*/
  136. {
  137. {
  138. { 1, "\216\217", 0, 0, 0 },
  139. { 1, "\216\217", 1, 0, 0 },
  140. { 1, "\216\217", USE_MBCURMAX, 0, 0 },
  141. }
  142. },
  143. {
  144. {
  145. { 0, 1, 0, },
  146. { 0, 1, -2, },
  147. { EILSEQ, 1, -1, },
  148. }
  149. }
  150. },
  151. { .is_last = 1 }
  152. }
  153. },
  154. #else
  155. {
  156. { Tmbrlen, TST_LOC_ja_UTF8 },
  157. {
  158. { /*----------------- #01 -----------------*/
  159. {
  160. {
  161. { 1, "\345\222\214", 1, 1, 1 },
  162. { 0, "", 0, 1, 0 },
  163. { 1, "\345\222\214", USE_MBCURMAX, 1, 1 },
  164. }
  165. },
  166. {
  167. {
  168. { 0, 1, -2, },
  169. { 0, 1, -1, },
  170. { 0, 1, 3, },
  171. }
  172. }
  173. },
  174. { /*----------------- #02 -----------------*/
  175. {
  176. {
  177. { 1, "\317", 1, 1, 0 },
  178. { 1, "\266", 1, 1, 0 },
  179. { 1, "\345\222\214", USE_MBCURMAX, 0, 0 },
  180. }
  181. },
  182. {
  183. {
  184. { 0, 1, -2, },
  185. #ifdef SHOJI_IS_RIGHT
  186. { 0, 1, +2, },
  187. #else
  188. /* XXX ISO C explicitly says that the return value does not
  189. XXX reflect the bytes contained in the state. */
  190. { 0, 1, +1, },
  191. #endif
  192. { 0, 1, 3, },
  193. }
  194. }
  195. },
  196. { /*----------------- #03 -----------------*/
  197. {
  198. {
  199. { 1, "\302\303", 0, 0, 0 },
  200. { 1, "\302\303", 1, 0, 0 },
  201. { 1, "\302\303", USE_MBCURMAX, 0, 0 },
  202. }
  203. },
  204. {
  205. {
  206. { 0, 1, 0, },
  207. { 0, 1, -2, },
  208. { EILSEQ, 1, -1, },
  209. }
  210. }
  211. },
  212. { .is_last = 1 }
  213. }
  214. },
  215. #endif
  216. {
  217. { Tmbrlen, TST_LOC_end }
  218. }
  219. };