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