1/******************************************************************** 2 * COPYRIGHT: 3 * Copyright (c) 1997-2012, International Business Machines Corporation and 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" 15 16#if !UCONFIG_NO_FORMATTING 17 18#include "cintltst.h" 19#include "unicode/ugender.h" 20 21static const UGender kAllFemale[] = {UGENDER_FEMALE, UGENDER_FEMALE}; 22 23#define LENGTHOF(array) (int32_t)(sizeof(array) / sizeof((array)[0])) 24 25void addGendInfoForTest(TestNode** root); 26static void TestGenderInfo(void); 27 28#define TESTCASE(x) addTest(root, &x, "tsformat/cgendtst/" #x) 29 30void addGendInfoForTest(TestNode** root) 31{ 32 TESTCASE(TestGenderInfo); 33} 34 35static void TestGenderInfo(void) { 36 UErrorCode status = U_ZERO_ERROR; 37 const UGenderInfo* actual_gi = ugender_getInstance("fr_CA", &status); 38 UGender actual; 39 if (U_FAILURE(status)) { 40 log_err_status(status, "Fail to create UGenderInfo - %s (Are you missing data?)", u_errorName(status)); 41 return; 42 } 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)); 46 return; 47 } 48 if (actual != UGENDER_FEMALE) { 49 log_err("Expected UGENDER_FEMALE got %d\n", actual); 50 } 51} 52 53#endif /* #if !UCONFIG_NO_FORMATTING */ 54