+// Try LocalXyzPointer types with NULL pointers.
+void LocalPointerTest::TestLocalXyzPointerNull() {
+ {
+ IcuTestErrorCode errorCode(*this, "TestLocalXyzPointerNull/LocalUConverterSelectorPointer");
+ static const char *const encoding="ISO-8859-1";
+ LocalUConverterSelectorPointer null;
+ LocalUConverterSelectorPointer sel(
+ ucnvsel_open(&encoding, 1, NULL, UCNV_ROUNDTRIP_SET, errorCode));
+ sel.adoptInstead(NULL);
+ }
+#if !UCONFIG_NO_FORMATTING
+ {
+ IcuTestErrorCode errorCode(*this, "TestLocalXyzPointerNull/LocalUCalendarPointer");
+ LocalUCalendarPointer null;
+ LocalUCalendarPointer cal(ucal_open(NULL, 0, "root", UCAL_GREGORIAN, errorCode));
+ if(!errorCode.logDataIfFailureAndReset("ucal_open()")) {
+ cal.adoptInstead(NULL);
+ }
+ }
+ {
+ IcuTestErrorCode errorCode(*this, "TestLocalXyzPointerNull/LocalUDateTimePatternGeneratorPointer");
+ LocalUDateTimePatternGeneratorPointer null;
+ LocalUDateTimePatternGeneratorPointer patgen(udatpg_open("root", errorCode));
+ patgen.adoptInstead(NULL);
+ }
+ {
+ IcuTestErrorCode errorCode(*this, "TestLocalXyzPointerNull/LocalUMessageFormatPointer");
+ UnicodeString hello=UNICODE_STRING_SIMPLE("Hello {0}!");
+ LocalUMessageFormatPointer null;
+ LocalUMessageFormatPointer msg(
+ umsg_open(hello.getBuffer(), hello.length(), "root", NULL, errorCode));
+ msg.adoptInstead(NULL);
+ }
+#endif /* !UCONFIG_NO_FORMATTING */
+
+#if !UCONFIG_NO_REGULAR_EXPRESSIONS
+ {
+ IcuTestErrorCode errorCode(*this, "TestLocalXyzPointerNull/LocalURegularExpressionPointer");
+ UnicodeString pattern=UNICODE_STRING_SIMPLE("abc|xy+z");
+ LocalURegularExpressionPointer null;
+ LocalURegularExpressionPointer regex(
+ uregex_open(pattern.getBuffer(), pattern.length(), 0, NULL, errorCode));
+ if(!errorCode.logDataIfFailureAndReset("urege_open()")) {
+ regex.adoptInstead(NULL);
+ }
+ }
+#endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */
+
+#if !UCONFIG_NO_TRANSLITERATION
+ {
+ IcuTestErrorCode errorCode(*this, "TestLocalXyzPointerNull/LocalUTransliteratorPointer");
+ UnicodeString id=UNICODE_STRING_SIMPLE("Grek-Latn");
+ LocalUTransliteratorPointer null;
+ LocalUTransliteratorPointer trans(
+ utrans_openU(id.getBuffer(), id.length(), UTRANS_FORWARD, NULL, 0, NULL, errorCode));
+ if(!errorCode.logDataIfFailureAndReset("utrans_openU()")) {
+ trans.adoptInstead(NULL);
+ }
+ }
+#endif /* !UCONFIG_NO_TRANSLITERATION */
+
+}