* IntlTest is a base class for tests.
*/
-#include <stdio.h>
-#include <string.h>
#include <assert.h>
#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
-#include "unicode/unistr.h"
-#include "unicode/ures.h"
-#include "unicode/smpdtfmt.h"
-#include "unicode/ucnv.h"
-#include "unicode/uclean.h"
-#include "unicode/timezone.h"
+#include "unicode/ctest.h" // for str_timeDelta
#include "unicode/curramt.h"
+#include "unicode/locid.h"
#include "unicode/putil.h"
+#include "unicode/smpdtfmt.h"
+#include "unicode/timezone.h"
+#include "unicode/uclean.h"
+#include "unicode/ucnv.h"
+#include "unicode/unistr.h"
+#include "unicode/ures.h"
#include "intltest.h"
+
#include "caltztst.h"
-#include "itmajor.h"
-#include "cstring.h"
-#include "umutex.h"
-#include "uassert.h"
#include "cmemory.h"
-#include "uoptions.h"
-
+#include "cstring.h"
+#include "itmajor.h"
+#include "mutex.h"
#include "putilimp.h" // for uprv_getRawUTCtime()
-#include "unicode/locid.h"
-#include "unicode/ctest.h" // for str_timeDelta
+#include "uassert.h"
#include "udbgutil.h"
+#include "umutex.h"
+#include "uoptions.h"
#ifdef XP_MAC_CONSOLE
#include <console.h>
vsprintf(buffer, fmt, ap);
va_end(ap);
if( verbose ) {
+ // TODO: change to default conversion in UnicodeString constructor.
logln(UnicodeString(buffer, ""));
}
}
}
}
+static UMutex messageMutex = U_MUTEX_INITIALIZER;
+
void IntlTest::LL_message( UnicodeString message, UBool newline )
{
+ // Synchronize this function.
+ // All error messages generated by tests funnel through here.
+ // Multithreaded tests can concurrently generate errors, requiring syncronization
+ // to keep each message together.
+ Mutex lock(&messageMutex);
+
// string that starts with a LineFeed character and continues
// with spaces according to the current indentation
static const UChar indentUChars[] = {
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
};
+ U_ASSERT(1 + LL_indentlevel <= UPRV_LENGTHOF(indentUChars));
UnicodeString indent(FALSE, indentUChars, 1 + LL_indentlevel);
char buffer[30000];