dat_wcsncmp.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
  3. *
  4. * FILE: dat_wcsncmp.c
  5. *
  6. * WCSNCMP: int wcsncmp (const wchar_t *ws1, const wchar_t *ws2,
  7. * size_t n);
  8. */
  9. TST_WCSNCMP tst_wcsncmp_loc [] = {
  10. {
  11. { Twcsncmp, TST_LOC_de },
  12. {
  13. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  14. { 0x00D1,0x00D2,0x00D3,0x0000 }, 4 }, /* #01 */
  15. /*expect*/ { 0,1,0, },
  16. },
  17. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  18. { 0x00D1,0x00D2,0x00D3,0x0000 }, 3 }, /* #02 */
  19. /*expect*/ { 0,1,0, },
  20. },
  21. { /*input.*/ { { 0x00D1,0x00D2,0x00D1,0x0000 },
  22. { 0x00D1,0x00D2,0x00D3,0x0000 }, 2 }, /* #03 */
  23. /*expect*/ { 0,1,0, },
  24. },
  25. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  26. { 0x00D0,0x00D2,0x00D3,0x0000 }, 0 }, /* #04 */
  27. /*expect*/ { 0,1,0, },
  28. },
  29. { /*input.*/ { { 0x0000,0x00D2,0x00D3,0x0000 },
  30. { 0x0000,0x00D2,0x00D1,0x0000 }, 3 }, /* #05 */
  31. /*expect*/ { 0,1,0, },
  32. },
  33. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  34. { 0x0000,0x00D2,0x00D3,0x0000 }, 3 }, /* #06 */
  35. /*expect*/ { 0,1,0x00D1, },
  36. },
  37. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  38. { 0x00D1,0x00D2,0x00D9,0x0000 }, 2 }, /* #07 */
  39. /*expect*/ { 0,1,0, },
  40. },
  41. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  42. { 0x00D1,0x00D2,0x00D9,0x0000 }, 3 }, /* #08 */
  43. /*expect*/ { 0,1,-0x0006, },
  44. },
  45. { /*input.*/ { { 0x00D1,0x00D2,0x00D3,0x0000 },
  46. { 0x00D1,0x00D2,0x0000 }, 4 }, /* #09 */
  47. /*expect*/ { 0,1,0x00D3, },
  48. },
  49. { .is_last = 1 }
  50. }
  51. },
  52. {
  53. { Twcsncmp, TST_LOC_enUS },
  54. {
  55. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  56. { 0x0041,0x0042,0x0043,0x0000 }, 4 }, /* #01 */
  57. /*expect*/ { 0,1,0, },
  58. },
  59. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  60. { 0x0041,0x0042,0x0043,0x0000 }, 3 }, /* #02 */
  61. /*expect*/ { 0,1,0, },
  62. },
  63. { /*input.*/ { { 0x0041,0x0042,0x0041,0x0000 },
  64. { 0x0041,0x0042,0x0043,0x0000 }, 2 }, /* #03 */
  65. /*expect*/ { 0,1,0, },
  66. },
  67. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  68. { 0x0040,0x0042,0x0043,0x0000 }, 0 }, /* #04 */
  69. /*expect*/ { 0,1,0, },
  70. },
  71. { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
  72. { 0x0000,0x0042,0x0041,0x0000 }, 3 }, /* #05 */
  73. /*expect*/ { 0,1,0, },
  74. },
  75. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  76. { 0x0000,0x0042,0x0043,0x0000 }, 3 }, /* #06 */
  77. /*expect*/ { 0,1,0x0041, },
  78. },
  79. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  80. { 0x0041,0x0042,0x0049,0x0000 }, 2 }, /* #07 */
  81. /*expect*/ { 0,1,0, },
  82. },
  83. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  84. { 0x0041,0x0042,0x0049,0x0000 }, 3 }, /* #08 */
  85. /*expect*/ { 0,1,-0x0006, },
  86. },
  87. { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
  88. { 0x0041,0x0042,0x0000 }, 4 }, /* #09 */
  89. /*expect*/ { 0,1,0x0043, },
  90. },
  91. { .is_last = 1 }
  92. }
  93. },
  94. {
  95. #if 0
  96. { Twcsncmp, TST_LOC_eucJP },
  97. #else
  98. { Twcsncmp, TST_LOC_ja_UTF8 },
  99. #endif
  100. {
  101. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  102. { 0x3041,0x3042,0x3043,0x0000 }, 4 }, /* #01 */
  103. /*expect*/ { 0,1,0, },
  104. },
  105. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  106. { 0x3041,0x3042,0x3043,0x0000 }, 3 }, /* #02 */
  107. /*expect*/ { 0,1,0, },
  108. },
  109. { /*input.*/ { { 0x3041,0x3042,0x3041,0x0000 },
  110. { 0x3041,0x3042,0x3043,0x0000 }, 2 }, /* #03 */
  111. /*expect*/ { 0,1,0, },
  112. },
  113. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  114. { 0x3040,0x3042,0x3043,0x0000 }, 0 }, /* #04 */
  115. /*expect*/ { 0,1,0, },
  116. },
  117. { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
  118. { 0x0000,0x3042,0x3041,0x0000 }, 3 }, /* #05 */
  119. /*expect*/ { 0,1,0, },
  120. },
  121. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  122. { 0x0000,0x3042,0x3043,0x0000 }, 3 }, /* #06 */
  123. /*expect*/ { 0,1,0x3041, },
  124. },
  125. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  126. { 0x3041,0x3042,0x3049,0x0000 }, 2 }, /* #07 */
  127. /*expect*/ { 0,1,0, },
  128. },
  129. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  130. { 0x3041,0x3042,0x3049,0x0000 }, 3 }, /* #08 */
  131. /*expect*/ { 0,1,-0x0006, },
  132. },
  133. { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
  134. { 0x3041,0x3042,0x0000 }, 4 }, /* #09 */
  135. /*expect*/ { 0,1,0x3043, },
  136. },
  137. { .is_last = 1 }
  138. }
  139. },
  140. {
  141. { Twcsncmp, TST_LOC_end }
  142. }
  143. };