tst_wcspbrk.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. WCSPBRK: wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2);
  3. */
  4. #define TST_FUNCTION wcspbrk
  5. #include "tsp_common.c"
  6. #include "dat_wcspbrk.c"
  7. int
  8. tst_wcspbrk (FILE * fp, int debug_flg)
  9. {
  10. TST_DECL_VARS (wchar_t *);
  11. wchar_t *ws1, *ws2;
  12. int err;
  13. wchar_t wc_ex;
  14. TST_DO_TEST (wcspbrk)
  15. {
  16. TST_HEAD_LOCALE (wcspbrk, S_WCSPBRK);
  17. TST_DO_REC (wcspbrk)
  18. {
  19. TST_GET_ERRET (wcspbrk);
  20. ws1 = TST_INPUT (wcspbrk).ws1;
  21. ws2 = TST_INPUT (wcspbrk).ws2;
  22. ret = wcspbrk (ws1, ws2);
  23. if (debug_flg)
  24. {
  25. fprintf (stdout, "wcspbrk() [ %s : %d ] ret = %s\n", locale,
  26. rec + 1, (ret == NULL) ? "null" : "not null");
  27. if (ret)
  28. fprintf (stderr,
  29. " ret[0] = 0x%lx : 0x%lx = ws2[0]\n",
  30. (unsigned long int) ret[0], (unsigned long int) ws2[0]);
  31. }
  32. TST_IF_RETURN (S_WCSPBRK)
  33. {
  34. if (ws2[0] == 0)
  35. {
  36. if (ret == ws1)
  37. {
  38. Result (C_SUCCESS, S_WCSPBRK, CASE_3, MS_PASSED);
  39. }
  40. else
  41. {
  42. err_count++;
  43. Result (C_FAILURE, S_WCSPBRK, CASE_3,
  44. "return address is not same address as ws1");
  45. }
  46. continue;
  47. }
  48. wc_ex = TST_EXPECT (wcspbrk).wc;
  49. if (debug_flg)
  50. fprintf (stdout,
  51. " *ret = 0x%lx <-> 0x%lx = wc_ex\n",
  52. (unsigned long int) *ret, (unsigned long int) wc_ex);
  53. if (*ret != wc_ex)
  54. {
  55. err++;
  56. err_count++;
  57. Result (C_FAILURE, S_WCSPBRK, CASE_4, "the pointed wc is "
  58. "different from an expected wc");
  59. }
  60. else
  61. {
  62. Result (C_SUCCESS, S_WCSPBRK, CASE_4, MS_PASSED);
  63. }
  64. }
  65. }
  66. }
  67. return err_count;
  68. }