dat_wcsstr.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
  3. *
  4. * FILE: dat_wcsstr.c
  5. *
  6. * WCSSTR: wchar_t *wcsstr (const wchar_t *ws1, const wchar_t *ws2);
  7. */
  8. /*
  9. * NOTE:
  10. * This is not a locale sensitive function.
  11. * So those data in each locale doesn't make sense ...
  12. * (redundant test cases)
  13. */
  14. TST_WCSSTR tst_wcsstr_loc [] = {
  15. {
  16. { Twcsstr, TST_LOC_de },
  17. {
  18. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  19. { 0x00D1,0x0000 }, }, /* #01 */
  20. /*expect*/ { 0,0,0, },
  21. },
  22. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  23. { 0x00D2,0x0000 }, }, /* #02 */
  24. /*expect*/ { 0,0,0, },
  25. },
  26. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  27. { 0x00D3,0x0000 }, }, /* #03 */
  28. /*expect*/ { 0,0,0, },
  29. },
  30. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  31. { 0x00D1,0x00D2,0x0000 }, }, /* #04 */
  32. /*expect*/ { 0,0,0, },
  33. },
  34. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  35. { 0x00D2,0x00D3,0x0000 }, }, /* #05 */
  36. /*expect*/ { 0,0,0, },
  37. },
  38. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  39. { 0x00D1,0x00D2,0x00D3,0x0000 }, }, /* #06 */
  40. /*expect*/ { 0,0,0, },
  41. },
  42. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  43. { 0x00D2,0x00D3,0x00D4,0x0000 }, }, /* #07 */
  44. /*expect*/ { 0,1,(wchar_t *)NULL, },
  45. },
  46. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  47. { 0x00D0,0x00D1,0x00D2,0x0000 }, }, /* #08 */
  48. /*expect*/ { 0,1,(wchar_t *)NULL, },
  49. },
  50. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  51. { 0x0000 }, }, /* #09 */
  52. /*expect*/ { 0,0,0, },
  53. },
  54. { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
  55. { 0x00D1,0x0000 }, }, /* #10 */
  56. /*expect*/ { 0,1,(wchar_t *)NULL, },
  57. },
  58. { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
  59. { 0x0000 }, }, /* #11 */
  60. /*expect*/ { 0,0,0, },
  61. },
  62. { .is_last = 1 }
  63. }
  64. },
  65. {
  66. { Twcsstr, TST_LOC_enUS },
  67. {
  68. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  69. { 0x0041,0x0000 }, }, /* #01 */
  70. /*expect*/ { 0,0,0, },
  71. },
  72. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  73. { 0x0042,0x0000 }, }, /* #02 */
  74. /*expect*/ { 0,0,0, },
  75. },
  76. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  77. { 0x0043,0x0000 }, }, /* #03 */
  78. /*expect*/ { 0,0,0, },
  79. },
  80. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  81. { 0x0041,0x0042,0x0000 }, }, /* #04 */
  82. /*expect*/ { 0,0,0, },
  83. },
  84. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  85. { 0x0042,0x0043,0x0000 }, }, /* #05 */
  86. /*expect*/ { 0,0,0, },
  87. },
  88. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  89. { 0x0041,0x0042,0x0043,0x0000 }, }, /* #06 */
  90. /*expect*/ { 0,0,0, },
  91. },
  92. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  93. { 0x0042,0x0043,0x0044,0x0000 }, }, /* #07 */
  94. /*expect*/ { 0,1,(wchar_t *)NULL, },
  95. },
  96. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  97. { 0x0040,0x0041,0x0042,0x0000 }, }, /* #08 */
  98. /*expect*/ { 0,1,(wchar_t *)NULL, },
  99. },
  100. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  101. { 0x0000 }, }, /* #09 */
  102. /*expect*/ { 0,0,0, },
  103. },
  104. { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
  105. { 0x0041,0x0000 }, }, /* #10 */
  106. /*expect*/ { 0,1,(wchar_t *)NULL, },
  107. },
  108. { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
  109. { 0x0000 }, }, /* #11 */
  110. /*expect*/ { 0,0,0, },
  111. },
  112. { .is_last = 1 }
  113. }
  114. },
  115. {
  116. #if 0
  117. { Twcsstr, TST_LOC_eucJP },
  118. #else
  119. { Twcsstr, TST_LOC_ja_UTF8 },
  120. #endif
  121. {
  122. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  123. { 0x3041,0x0000 }, }, /* #01 */
  124. /*expect*/ { 0,0,0, },
  125. },
  126. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  127. { 0x3042,0x0000 }, }, /* #02 */
  128. /*expect*/ { 0,0,0, },
  129. },
  130. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  131. { 0x3043,0x0000 }, }, /* #03 */
  132. /*expect*/ { 0,0,0, },
  133. },
  134. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  135. { 0x3041,0x3042,0x0000 }, }, /* #04 */
  136. /*expect*/ { 0,0,0, },
  137. },
  138. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  139. { 0x3042,0x3043,0x0000 }, }, /* #05 */
  140. /*expect*/ { 0,0,0, },
  141. },
  142. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  143. { 0x3041,0x3042,0x3043,0x0000 }, }, /* #06 */
  144. /*expect*/ { 0,0,0, },
  145. },
  146. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  147. { 0x3042,0x3043,0x3044,0x0000 }, }, /* #07 */
  148. /*expect*/ { 0,1,(wchar_t *)NULL, },
  149. },
  150. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  151. { 0x3040,0x3041,0x3042,0x0000 }, }, /* #08 */
  152. /*expect*/ { 0,1,(wchar_t *)NULL, },
  153. },
  154. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  155. { 0x0000 }, }, /* #09 */
  156. /*expect*/ { 0,0,0, },
  157. },
  158. { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
  159. { 0x3041,0x0000 }, }, /* #10 */
  160. /*expect*/ { 0,1,(wchar_t *)NULL, },
  161. },
  162. { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
  163. { 0x0000 }, }, /* #11 */
  164. /*expect*/ { 0,0,0, },
  165. },
  166. { .is_last = 1 }
  167. }
  168. },
  169. {
  170. { Twcsstr, TST_LOC_end }
  171. }
  172. };