// Get the result string:
int32_t len;
const UChar* str = ufmtval_getString(unumrf_resultAsValue(uresult, &ec), &len, &ec);
- if (assertSuccessCheck("There should not be a failure in the example code", &ec, TRUE)) {
- assertUEquals("Should produce expected string result", u"$3 – $5", str);
- assertIntEquals("Length should be as expected", u_strlen(str), len);
- }
+ assertSuccessCheck("There should not be a failure in the example code", &ec, TRUE);
+ assertUEquals("Should produce expected string result", u"$3 – $5", str);
+ int32_t resultLength = str != NULL ? u_strlen(str) : 0;
+ assertIntEquals("Length should be as expected", resultLength, len);
// Cleanup:
unumrf_close(uformatter);