/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2011, International Business Machines Corporation and
+ * Copyright (c) 1997-2013, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
#include "unicode/fmtable.h"
#include "unicode/testlog.h"
+
+#if U_NO_DEFAULT_INCLUDE_UTF_HEADERS
+/* deprecated - make tests pass with U_NO_DEFAULT_INCLUDE_UTF_HEADERS */
+#include "unicode/utf_old.h"
+#endif
+
+/**
+ * \def ICU_USE_THREADS
+ *
+ * Enables multi-threaded testing. Moved here from uconfig.h.
+ * Default: enabled
+ *
+ * This switch used to allow thread support (use of mutexes) to be compiled out of ICU.
+ */
+#ifdef ICU_USE_THREADS
+ /* Use the predefined value. */
+#elif defined(APP_NO_THREADS)
+ /* APP_NO_THREADS is an old symbol. We'll honour it if present. */
+# define ICU_USE_THREADS 0
+#else
+# define ICU_USE_THREADS 1
+#endif
+
U_NAMESPACE_USE
#if U_PLATFORM == U_PF_OS390
break; \
}
+#define TEST_ASSERT_TRUE(x) \
+ assertTrue(#x, (x), FALSE, FALSE, __FILE__, __LINE__)
+
class IntlTest : public TestLog {
public:
virtual UBool setNoErrMsg( UBool no_err_msg = TRUE );
virtual UBool setQuick( UBool quick = TRUE );
virtual UBool setLeaks( UBool leaks = TRUE );
+ virtual UBool setNotime( UBool no_time = TRUE );
virtual UBool setWarnOnMissingData( UBool warn_on_missing_data = TRUE );
virtual int32_t setThreadCount( int32_t count = 1);
protected:
/* JUnit-like assertions. Each returns TRUE if it succeeds. */
- UBool assertTrue(const char* message, UBool condition, UBool quiet=FALSE, UBool possibleDataError=FALSE);
+ UBool assertTrue(const char* message, UBool condition, UBool quiet=FALSE, UBool possibleDataError=FALSE, const char *file=NULL, int line=0);
UBool assertFalse(const char* message, UBool condition, UBool quiet=FALSE);
UBool assertSuccess(const char* message, UErrorCode ec, UBool possibleDataError=FALSE);
UBool assertEquals(const char* message, const UnicodeString& expected,
const UnicodeString& actual, UBool possibleDataError=FALSE);
UBool assertEquals(const char* message, const char* expected,
const char* actual);
+ UBool assertEquals(const char* message, int32_t expected, int32_t actual);
#if !UCONFIG_NO_FORMATTING
UBool assertEquals(const char* message, const Formattable& expected,
const Formattable& actual);
UBool quick;
UBool leaks;
UBool warn_on_missing_data;
+ UBool no_time;
int32_t threadCount;
private:
static UnicodeString &prettify(const UnicodeString &source, UnicodeString &target);
static UnicodeString prettify(const UnicodeString &source, UBool parseBackslash=FALSE);
+ // digits=-1 determines the number of digits automatically
static UnicodeString &appendHex(uint32_t number, int32_t digits, UnicodeString &target);
+ static UnicodeString toHex(uint32_t number, int32_t digits=-1);
+ static inline UnicodeString toHex(int32_t number, int32_t digits=-1) {
+ return toHex((uint32_t)number, digits);
+ }
public:
static void setICU_DATA(); // Set up ICU_DATA if necessary.