aboutsummaryrefslogtreecommitdiff
path: root/localedata/tests-mbwc/tst_wctrans.c
blob: 129b797fb34ada5d2bcb6b9d8fd64efcd768c17e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
  WCTRANS: wctrans_t wctrans (const char *charclass);
*/

#define TST_FUNCTION wctrans

#include "tsp_common.c"
#include "dat_wctrans.c"

int
tst_wctrans (FILE * fp, int debug_flg)
{
  TST_DECL_VARS (wctrans_t);
  char *class;

  TST_DO_TEST (wctrans)
  {
    TST_HEAD_LOCALE (wctrans, S_WCTRANS);
    TST_DO_REC (wctrans)
    {
      TST_GET_ERRET (wctrans);
      class = TST_INPUT (wctrans).class;

      TST_CLEAR_ERRNO;
      ret = wctrans (class);
      TST_SAVE_ERRNO;

      if (debug_flg)
	{
	  fprintf (stderr, "tst_wctrans : [ %d ] ret = %d\n", rec + 1, ret);
	  fprintf (stderr, "		       errno = %d\n", errno_save);
	}

      TST_IF_RETURN (S_WCTRANS)
      {
	if (ret != 0)
	  {
	    Result (C_SUCCESS, S_WCTYPE, CASE_3, MS_PASSED);
	  }
	else
	  {
	    err_count++;
	    Result (C_FAILURE, S_WCTYPE, CASE_3,
		    "should return non-0, but returned 0");
	  }
      }
    }
  }

  return err_count;
}