/* * Converts a string to its corresponding UnitKind_t enumeration value. * * @param name a string, the name of a predefined base unit in SBML * * @return a value from UnitKind_t corresponding to the given name * (determined in a case-insensitive manner). */ LIBSBML_EXTERN UnitKind_t UnitKind_forName (const char *name) { if (name != NULL) { const UnitKind_t lo = UNIT_KIND_AMPERE; const UnitKind_t hi = UNIT_KIND_WEBER; return util_bsearchStringsI(UNIT_KIND_STRINGS, name, lo, hi); } else return UNIT_KIND_INVALID; }
END_TEST START_TEST (test_util_accessWithNULL) { fail_unless ( util_bsearchStringsI(NULL, NULL, 0, 0) == 1 ); fail_unless ( util_file_exists(NULL) == 0 ); util_free(NULL); fail_unless ( util_trim(NULL) == NULL ); fail_unless ( util_trim_in_place(NULL) == NULL ); fail_unless ( safe_fopen(NULL, NULL) == NULL ); fail_unless ( safe_strcat(NULL, NULL) == NULL ); fail_unless ( safe_strdup(NULL) == NULL ); }