]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/cintltst/cgendtst.c
ICU-57166.0.1.tar.gz
[apple/icu.git] / icuSources / test / cintltst / cgendtst.c
CommitLineData
51004dcb
A
1/********************************************************************
2 * COPYRIGHT:
b331163b 3 * Copyright (c) 1997-2014, International Business Machines Corporation and
51004dcb
A
4 * others. All Rights Reserved.
5 ********************************************************************/
6/********************************************************************************
7*
8* File CGENDTST.C
9*********************************************************************************
10*/
11
12/* C API TEST FOR GENDER INFO */
13
14#include "unicode/utypes.h"
b331163b 15#include "cmemory.h"
51004dcb
A
16
17#if !UCONFIG_NO_FORMATTING
18
19#include "cintltst.h"
20#include "unicode/ugender.h"
21
22static const UGender kAllFemale[] = {UGENDER_FEMALE, UGENDER_FEMALE};
23
51004dcb
A
24void addGendInfoForTest(TestNode** root);
25static void TestGenderInfo(void);
26
27#define TESTCASE(x) addTest(root, &x, "tsformat/cgendtst/" #x)
28
29void addGendInfoForTest(TestNode** root)
30{
31 TESTCASE(TestGenderInfo);
32}
33
34static void TestGenderInfo(void) {
35 UErrorCode status = U_ZERO_ERROR;
36 const UGenderInfo* actual_gi = ugender_getInstance("fr_CA", &status);
37 UGender actual;
38 if (U_FAILURE(status)) {
39 log_err_status(status, "Fail to create UGenderInfo - %s (Are you missing data?)", u_errorName(status));
40 return;
41 }
b331163b 42 actual = ugender_getListGender(actual_gi, kAllFemale, UPRV_LENGTHOF(kAllFemale), &status);
51004dcb
A
43 if (U_FAILURE(status)) {
44 log_err("Fail to get gender of list - %s\n", u_errorName(status));
45 return;
46 }
47 if (actual != UGENDER_FEMALE) {
48 log_err("Expected UGENDER_FEMALE got %d\n", actual);
49 }
50}
51
52#endif /* #if !UCONFIG_NO_FORMATTING */