]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/cintltst/cgendtst.c
1 /********************************************************************
3 * Copyright (c) 1997-2012, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
6 /********************************************************************************
9 *********************************************************************************
12 /* C API TEST FOR GENDER INFO */
14 #include "unicode/utypes.h"
16 #if !UCONFIG_NO_FORMATTING
19 #include "unicode/ugender.h"
21 static const UGender kAllFemale
[] = {UGENDER_FEMALE
, UGENDER_FEMALE
};
23 #define LENGTHOF(array) (int32_t)(sizeof(array) / sizeof((array)[0]))
25 void addGendInfoForTest(TestNode
** root
);
26 static void TestGenderInfo(void);
28 #define TESTCASE(x) addTest(root, &x, "tsformat/cgendtst/" #x)
30 void addGendInfoForTest(TestNode
** root
)
32 TESTCASE(TestGenderInfo
);
35 static void TestGenderInfo(void) {
36 UErrorCode status
= U_ZERO_ERROR
;
37 const UGenderInfo
* actual_gi
= ugender_getInstance("fr_CA", &status
);
39 if (U_FAILURE(status
)) {
40 log_err_status(status
, "Fail to create UGenderInfo - %s (Are you missing data?)", u_errorName(status
));
43 actual
= ugender_getListGender(actual_gi
, kAllFemale
, LENGTHOF(kAllFemale
), &status
);
44 if (U_FAILURE(status
)) {
45 log_err("Fail to get gender of list - %s\n", u_errorName(status
));
48 if (actual
!= UGENDER_FEMALE
) {
49 log_err("Expected UGENDER_FEMALE got %d\n", actual
);
53 #endif /* #if !UCONFIG_NO_FORMATTING */